Reference Selector populated before page parameter is available (pulldown not populated)

0
Edit: I think the key to understanding the problem is: If I commit the record in the microflow before opening the Edit page, the pulldown is correctly filtered. If the record is not committed the pulldown has no options. I'm always passing the same object to the page. The only difference is commited vs. not committed. Reference Selector populated before page parameter is available when a form is loaded with a new object passed in from a microflow. As a result, the pulldown shows no options. Hi everyone, I hope you can help me understand how Mendix works. I'm new to the platform. My Domain Model is as follows: An Assessment has many Question Groups. A Question Group has many Questions. An Assessment has many Subcategories. A Subcategory has many Questions.   Page Question_NewEdit requires a page parameter of type Question.  It includes an attribute that uses the Question parameter to display the Question's Subcategory and a Reference Selector to choose the Question's Group. The possible selections for the Group are limited using an xPath based on the Question object and '[CurrentObject]'. When I edit records using this page from the standard Edit button everything works as expected, including that the pulldown for Group shows only groups of the related Assessment. Problem In order to Add records, I use a microflow. This microflow associates the newly created Question to the Group that was used in the previous question and opens the Question_NewEdit page, passing in the uncommitted Question object. The problem is that the Reference Selector for the Group is blank and has no options in the pulldown. I know the parameter is properly passed in because the Subcategory attribute shows correctly on the page. I know the Group is set correctly because if I remove the xPath constraint for the Group the selected option is correct (but the Group pulldown shows Groups from unrelated Assessments).   I tried using a microflow datasource for the Group Reference Selector and noticed that it thinks the page parameter is null when creating a new question but not when editing an existing one. Keep in mind that the Subcategory attribute is displaying the correct Subcategory in all cases so I know the Question parameter is correctly set. As a workaround, I can commit the Question before openning the Question_NewEdit form and then delete it if the user hits cancel, but I'd like to understand why the Group Reference Selector is not receiving the Question object passed in as a Page Parameter. I'd also prefer to avoid creating objects before the user clicks Save. Thanks   Edit:  Solution: The Reference Selector was not populating because I was filtering by comparing to an uncommitted object (Question). If instead I compare to an attribute of that uncommitted object, the filter works as expected. Specifically, the end of my filter now looks like = $Question/Assessments.Question_Subcategory.
asked
1 answers
1

if you use an xpath the entry must be in the database (committed).

You can use a microflow and debug the microflow to see if the input parameter is passed correctly. If the input is correct you can receive the retrieve the subcategory by asssocation and retrieve the assesment by assocation. From the assesment you can retrieve the list fo subcategories available?

Does this work for you?

answered