List Operations: How to find objects that meet certain criteria

0
Hi everybody!   I'm somehow stuck to find a way to filter out certain objects from a list. Maybe someone has a tip how I could proceed.    I have retrieved a list of a non-persistent entity in a nanoflow (via association of the current object). On the list have the following objects:   1. 13.5. , "Tour 1" 2. 14.5. , "Tour 1" 3. 15.5. , "Tour 1" 4. 13.5. , "Tour 2" 5. 13.5. , "Tour 3" 6. 14.5. , "Tour 3" 7. 15.5. , "Tour 3"   The list will contain many more dates in reality. I would like to know at the end, that the 13.5. appears for all three tours. 1. 13.5. , "Tour 1" 2. 13.5. , "Tour 2" 3. 13.5. , "Tour 3"   --> 13.5. should (in this simple case) remain on the list / non-persistent entity   I guess a loop will become very slow if the list contains approx. 500 entries, correct?   Does anybody have an idea?   Thanks in advance!
asked
2 answers
0

Maybe I didn't understand correctly but Have you tried List Operation? You can filter by attribute.

If you want to list the Tours that have the same times and you don't know the values before hand you need to loop.

500 is not that many entries if the logic is simple.

answered
0

First create an empty result list. Then I would retrieve the first object in the list with the head function. Then filter the main list based on the date value 13.5. If the count is less then three you can already remove the object from the main list and use head to take the next object. If it is more then three then check this new filtered list and do 3 contain checks to see if tour 1, 2 and 3 are all in this new list. If yes move all the objects over to the result list. So remove them from the main list and add them to the result list. Then you can again do a head on the main list again and keep doing this untill the main list is empty. All the correct ones are then in your result list.

Regards,

Ronald

 

answered