Show atributes with max value

0
Hi , i think easy question, I created a microflow which calculates the highest value (age) and it will show this in a dataview, but how can i make a view which objects have this max value? Tried it with datagrid several Xpath commands but don't get it to work.   regards,michel 
asked
6 answers
1

Michel,

I've created a Model Share with an example of how to loop through a list of objects and change an association of each one.  You can get the Model Share https://modelshare.mendix.com/models/4c8abf57-52e7-44b6-82ad-3da0d05606de/example-loop-microflow

Mike

answered
1

Michel

In your microflow, are you populating the association that appears in your datamodel?  If so, you should be able to retrieve using that association.  

To do so, click the Select button in the window you have in your message, entity maxleeftijd will appear at the top of the entity window.  Expand it and you'll see the association.  Expand the association and you'll see the Medewerkers entity.  Click on that and the Modeler will generate the correct XPath.

Hope that helps,

Mike

answered
1

answered
1

Thanks for the clarification.

In order to retrieve the list of people whose age is equal to the max age, you'll need to add a loop to your microflow.  Loop over MedwerkersList and in the loop, update each MedewerkersList object by setting the value of the association Medewerkers_maxleeftijd with a conditional that looks something like:

if $iteratorMedewerkersList/leeftijd = $Maximumleeftijd
then
  $NewMaxleeftijd
else
  empty

Once you do that, In your retrieve Xpath on the datagrid, select the Medewerkers entity and have an Xpath that looks like:

[MedewerkersList.Medewerkers_maxleeftijd = '[%CurrentObject%]']

Hope that helps  

answered
1

Here you go.  I've also included the properties of the assocation in the picture:

answered
0

Mike,

Can you show me the picture of the domain model so i have the complete picture, i'm getting there but my microflow is filling a lot of empty items...

Thanks for your help/.

answered