The data in the 2nd reference selector has to be different based on the selected item in the 1st reference selector

0
Hi! I'm trying to make a native app where the user has to fill a form and select multiple options. Somewhere in the form the user has to select a value in the first selector (let's say the brand of a car). Based on the choice, the next selector should only show the models associated with the chosen brand (a Toyota should give the Aygo, but Ferrari shouldn't). Below is the domain model which I use in. The entity on the left is the form-entity which is build whilst filling the form.   This is part of the form. If a brand is selected, the model must only show the possible models associated with the chosen brand.   I tried using xPath (but no success). Can anyone point me in the right direction? Much appreciated!
asked
4 answers
2

The Constrained by option as in Web is not available in Native. Until Mendix adds that to Native as well, the next best option is to use popup pages. I use a button with a caption to show that a selection can be made, if a selection has been made, the caption shows the selected item. Clicking the button opens the selection page. You will need to use a datasource nanoflow for the second selection page to restrict the items in the list. 

Especially for phone apps you could implement a wizard style approach where each selection is on a separate page, showing the list of available items directly. Tapping an item selects it, updates the object and opens the next step. The final page would then show the completed form.

answered
1

Hello Erik ten Asbroek,

 

Your Domain Model is correctly configured. All you need is to configure your reference selector widget for Model to constrain it using the Constrained by option present under the XPath Menu of the “Selectable objects” path. When you click on it, Mendix will automatically prompt you to select the path via the Brand (since your Domain model is already configured in a correct way)

 

A more detail information on constraining the second reference selector based on the first can be found in Mendix Docs which is very well explained. I am attaching the link here for future reference.

https://docs.mendix.com/refguide/reference-selector/#xpath-constraints

 

Incase if this answer helped you in figuring out the solution to your problem, do mark the answer as “Accepted” which helps others to find out the answers faster. :)

answered
0

you can use xpath  as answered above or microflow  if you want to  use microflow as data source for selectable object you can retrieve models associated with the chosen brand using retrieve by association  

 

 

answered
0

For reference (joke not intended), this is what I see when editing the reference selector:

answered