How to show list based on passed object

0
Hi guys, I am new on mendix and trying to figure out a solution for following   scenario: 1. I have an Entity "Resource" and an Entity "Planning". The relation is 1 to many. So one resource can have multiple plannings, but one planning can only be associated with one resource. 2. I have a page with a list of my resources. (ListView) On each of the resources there is a button "Jump to planning" 3. After selecting the button "Jump to planning" a microflow "Open Planning" starts. 4. On that microflow I have an paramater called "resource". So I created an activity "Show Page" and selected "resource" as Object to pass. 5. The page "planning" will be opened after the microflow. 6. On the page "planning" I have a ListView of the Entity "planning"   Problem: The ListView "planning" shows me the planning of all resources, but I need only the plannings of the selected resource.   What I tried: 1. XPath:  I selected Type "Xpath" as Data source and wanted to filter by the passed resource object. So I began to type on the area of "XPath constraint" following code: [Module.Planning_Resource=$Resource] However I get an error message: "Unknown variable "Resource"" I don't know how to pass the resource object so I can use it as a variable in the XPath constraint.   2. Microflow as Data source I created a microflow called "FilteredPlanning". This microflow is triggered by the button "Jump to planning" of the resource ListView. So the microflow retrieves the object resource. I have an activity "Retrieve Objects" where I retrieve a planning object and have following Xpath constraints [Module.Planning_Resource=$Resource] After that activity I have the activity "Show Planning" and my end event retunrs type "list" and the created planning list. On the planning page I selected this microflow as source, but I got the message: "Parameters of the selected microflow do not match available arguments. No arguments are available while the microflow has paramter of type Module.Resource".   Can anybody help me? I just want to have a list of planning filtered by the resource I selected on the resource-list-view.
asked
2 answers
1

Omer,

The XPath approach is the easiest way to accomplish this. 

To make this work, on your Planning page, make sure you have a dataview pointed to Resource entity.  Inside of that dataview, place a Listview.  Select XPath for the datasource and in the Select Entity popup window, navigate from Resource to Planning (click the + sign next to Resource and then select the Planning entity that appears under Resource via the association.  It will look something like this:

The entity names above are different than yours, but hopefully this helps.

If you want to write the Xpath yourself, what you attempted above was very close.  The correct syntax would be 

[Module.Planning_Resource= '[%CurrentObject%]']

Hope that helps,

Mike

answered
-1

Hi Omer,

Welcome to the world of Mendix. Your question is about something what Mendix does out of the box for you. Assuming you got the data model right.

From the listview of resources you can open the planning page, that needs the resource as a page parameter.

The listview of the Planning can be filled via the association Planning_Resource. 

Have a look at https://gettingstarted.mendixcloud.com/link/path/14

 

 

answered