cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tilcoating
Frequent Visitor

Filter on multiple search items (like Bing)

Hi all,

 

I'm trying to filter a collection based on multiple search items.

I have a text box where the user can enter multiple text values.

I can make a collection from those individual text items via Split, so that I have a collection with all the search values.

But then I want to filter a collection based on all those search values in a specific field.

 

E.g. when I enter "red flag" I want to return all records with "red" AND "flag" in a specific field.

Is that possible?

 

I tried a ForAll on all Split-items and add them one by one to a collection, but then I get all records with either "red" or "flag" in it.

Thank you for any solution.

 

Jack

1 ACCEPTED SOLUTION

Accepted Solutions
Tilcoating
Frequent Visitor

Found a solution; RemoveIf.

That one works in a ForAll loop. 

So I start with a complete collection and then remove all items that don't have the search string in it.

 

Hope someone else finds it usefull.

ClearCollect(
    colZoekers;
    Split(
        txtZoek.Text;
        " "
    )
);;
ClearCollect(
    colRes;
    colPoeders
);;
ForAll(
    colZoekers;
    RemoveIf(
        colRes;
        !(Result in Intern)
    )
)

View solution in original post

1 REPLY 1
Tilcoating
Frequent Visitor

Found a solution; RemoveIf.

That one works in a ForAll loop. 

So I start with a complete collection and then remove all items that don't have the search string in it.

 

Hope someone else finds it usefull.

ClearCollect(
    colZoekers;
    Split(
        txtZoek.Text;
        " "
    )
);;
ClearCollect(
    colRes;
    colPoeders
);;
ForAll(
    colZoekers;
    RemoveIf(
        colRes;
        !(Result in Intern)
    )
)

Helpful resources

Top Solution Authors
Top Kudoed Authors
Users online (3,999)