Filter microflow sourced datagrid based on associated value

0
Ok, this I hope will make some form of sense…  In my app I have an entity CorePropertyInformation, each object of this entity can be linked to a part of our companies organisation structure, this is used for reporting.  There are 7 levels to the organisation structure, and the app handles Levels 2, 3, 4 and 5 Also, each object in CorePropertyInformation generates multiple events, these events can be reported on.  The user will generate the report by filling out a form (non-persistable entity). This includes the places to choose a level to report in, and also a reference selector that allows the user to choose a structure unit from the Level they want.   This is then passed to a microflow sourced data grid. The microflow will read the ReportSelections and return a list of objects accordingly. This is the microflow… (please also tell me if there’s a better way to do this) https://modelshare.mendix.com/models/aac54be7-d4a5-43c3-9dc9-d9a31b38a297/read-timescale-selections I want to add the ability to also filter this report on the organisation structure at any of the 4 levels that are handled.  I am not sure how to set this up. I have tried to filter on the retrieve to get records that equal the structure unit the user has selected but I have not been able to put the correct XPath in… if it’s even possible.  I have also tried making it so the structural units are also in the Event entity but this is the problem I get…  In my ‘Level2’ entity, there is a Structure name that I want to link to reference.  I’m a bit stuck… I hope this makes some form of sense.  
asked
2 answers
0

Garion,

I have had great success with the Grid Search widget for these kinds of complex search requirements.  Might help you with this.

Mike

answered
0

Hi Garion,

If you have associations to your report selection entity for a user to select an organization structure to filter on, then you can write this in your xpath constraint. 

Here is an example:

If you have a domain model similar to this:

and you want to retrieve events based on the association that is set to report selection, then your xpath will look like this:

[MyFirstModule.Event_OrganizationStructure = $ReportSelection/MyFirstModule.ReportSelection_OrganizationStructure]

 

The report selection needs to be persistent in order for you to use its association in an xpath retrieve. If you want it to be non-persistent, then you can retrieve the organization structure through the report selection object and use that in your retrieve.

[MyFirstModule.Event_OrganizationStructure = $OrganizationStructure]

 

 

Hope this helps!

answered