Retrieve a list using a list

If I have a list of objects of Entity B, which are children of Entity A, and I want to retrieve from the database a list of objects of Entity B but only the objects that are associated with my list of objects in Entity A, what is the best way to achieve this?
2 answers


By child objects, I am guess you mean that Entity A has a 1 → M association with Entity B.  If so, there are a couple of options, I can think of:

  • Create an Empty List of Entity A – lets call it ResultsList
  • Loop through the items in the Entity B list you have
  • Inside the Loop, retrieve Entity A where it is associated to the iterator Entity B
  • Add the results of this retrieve to ResultsList
  • After the loop is done, create a new list of Entity A by using a List Operation – Union of ResultsList to itself.  This will eliminate duplicates.
  • The resulting list is what you were trying to get.

Alternatively, you could

  • create a helper entity with a M→ M association with entity B
  • create a new object of this entity and populate the association with the list of Entity B that you have
  • use the helper entity to retrieve all Entity A objects via the association with Entity B

Maybe one of these alternatives will work for you.




There are multiple ways of doing that

  • You could have an xpath on your datagrid etc
  • Create a microflow and return the list

If you intend to retrieve objects of B which have an association to entity A, then just check if the association is not empty, something like:


The below documentation will also help you: