Is it possible to add different entities to the same list? Or how do I workaround not being able to?

0
So, I have a microflow that calls a list with one single entity as data source. I need the data from different entities as well, but I can't do it using multiple lists. The reason I need this is because I made a BulkEdit option which allows changing one single attribute in an entire data document. I did it by creating a microflow which calls the list in the screenshot below. This microflow then shows a page with all the attributes found in the entity selected as the datasource for the first microflow. Then there is a save button which opens another microflow. This microflow firstly retrieves the list and then iterates a change object in which every changable atribute is listed. (shown below). I need to expand this change attribute activity with a lot of attributes coming from different entities. Right now I can not select those because the list only retrieves the attributes coming from the entitiy it retrieves. I can't expand the list in the parameter. Help is much appriciated      
asked
4 answers
0

Hi!

Mendix doesn't allow different entities to be added to a list. You could make use of a helper entity which acts like an in-between object for this list, but you would need associations to each entity you would potentially want to add to the list, as well as decision-based logic in any subsequent microflows to check which object is connected to an iteration in the list.

 

 

answered
0

You can't show multiple entities in 1 list. There are ways around it, you can use a helper entity (non persistent) for example with all the required attributes and use that as an inbetween. In essence, you need a proxy. You then have 1 list of 1 entity, but that entity is hybrid copy of A B and C. 

It's dirty, but it's a possible workaround you can use. Otherwise: no, cant be done in 1 list. 

But why not just do a few retrieves and additional loops to change each entity seperately? 

 

answered
0

You can do multiple retrieves in one microflow, although it might get a bit messy, especially when retrieving more than two types of entities and doing things with those lists.

What I would do is create multiple submicroflows that each retrieves a list of one type of entity of the different entities you need and loops over that list to create an instance of the helper or ‘proxy’ entity described above and populate its attributes with the needed value of each iterator.

All those submicroflows return the list of the created ‘proxy’ entities, which can then be unioned into one list in the parent microflow.

 

Submicroflow creating a list of $HelperEntity based on $OriginalEntity (create one for each ‘original’ entity):

Calling the submicroflows and unioning the multiple lists of $HelperEntity:

answered
0

In relation to my comment above about generalizations:

 

answered