Filter a List of Items where a field in the list exists in an entity

0
Assume I have a list of cars that contain that is retrieved from an API and is stored in an NPE;   Make | Model Ford   | Fiesta     Ford   | Ka Audi   | A3 Audi   | A5 Volvo |  v40  Volvo | v70   I want to do a filter on the list of cars to only show me items that are in an options entity   options entity  Ford  Audi   In my real-world example, I have 5+ filters that I want to apply I have done the below.  Write And or OR in the 'filter by expression' query - Which I understand is bad practice (could be wrong)  Create a list for each filter and unioning them together - Feels wrong   The above is what I have tried and do work however I want to know if there is a better way to achieve this.     
asked
1 answers
0

Hi Katie,

 

As you conclude yourself: both options you mention will work fine.

 

Of course you need to keep performance in mind: in large sets of data the performance may be low. But in case of large sets you will probably be better of normalizing the data into separate entities, storing the data in persistable entities and then letting the database do the work.

 

The union by the way is not needed, if you apply each filter to the previously filtered list.

 

I hope this helps.

Michiel

answered