Which is best ( Filter or loop ) for performance improve

1
Hello Team ,   I need to know which will give the good performance . List operation filter or For Loop  Iteration .  If possible please let me know the reason also .    Thanks in Advance .
asked
1 answers
1

Hi Vinodhini,

 

From the Learningpath Master modeling Microflows:

 

List Functions vs. Loops

In general, list functions (aggregation/operations) are used when you want to apply logic to a list as a whole. Loops are used when you want to apply logic to each individual object in a list.

However, you may encounter situations in which using a loop would provide the same functionality as using a list operation. In these cases, it is important to evaluate if it is possible to use a more efficient list function instead.

 

Objects in Memory

When you are dealing with objects from the database in your microflows, you will mostly be using XPath to perform actions such as constraining, filtering, and sorting the data. However, you cannot use XPath for objects that only exist in memory.

That’s where List Operations come in. They are used when you are working with lists that only exist in memory and not (yet) in the database (for example, when you are working with non-persistent objects or persistent objects that have not yet been committed). These are some typical scenarios in which this is the case:

  • Integrations and web services in microflows that send/receive data
  • Data source microflows used by grid or list widgets
  • Creating report data to view in chart widgets
  • Avoiding complex XPaths
  • Reusing data from a list retrieved earlier

https://academy.mendix.com/link/modules/15/lectures/308/3.2-List-Operations

answered