Reference selector showing list of associated objects and data view to listen to user selection

0
Hi, This is actually 2 questions in 1 so if you take time to answer this I’d appreciate it very much. I’ve had a look at the documentation (https://docs.mendix.com/refguide/reference-selector) and read some similar forum questions (https://community.mendix.com/link/questions/8995, https://community.mendix.com/index4.html) but I don’t think they entirely match what I’m trying to do. The example in the documentation (first link) uses the hierarchy Order_Customer/Customer/Name to select a user from a list of users. However, how would I go about doing this the other way? So I would have a customer object on the page and I would populate a drop down list with all Orders the customer has made. A dataview on the same page would be listening to this drop down list and would receive the corresponding order object. So for clarification purposes, the dataview would display all relevant order information. Below is a diagram using my expert paint skills. Thanks in advance, Andrew
asked
2 answers
6

If you really want to select the order via a dropdown,  I'd suggest to use a nonpersitable helper object ‘OrderSelectionHelper’ with an association to customer, and to order.

- in your Customer dataview, create a dataview with a GetCreate microflow for the orderSelectionHelper:

- then in that dataview, add a reference selector, which sets the OrderSelectionHelper_Order association

- for the reference selector, you a microflow datasource, and retrieve the Orders of the Customer

- on the orderSelectionHelper dataview, add another dataview, via the association OrderSelectionHelper_Order

now when you select a value in your reference selector, you will see the selected Order in the dataview

 

answered
4

I think the easiest way to do this would be:

- have a Customer dataview

- on that Customer dataview, place a Orders datagrid (via association order_Customer)

- on that Customer dataview, and a dataview with datasource: Listen to widget ‘Orders datagrid’

- In that Orders dataview, you can put the details of the order

In Mendix, this looks like this:

answered