Mendix Drop-Down Datasource

Hello, I’m trying to populate a Drop-Down from a microflow and have spent literal hours on this with no luck. Here’s the step by step: Data View in page has it’s data source set to a microflow. The microflow calls a rest API and receives Json as shown below [ { "id": 2, "timeStamp": "02-May-2019 17:08:56" }, { "id": 22, "timeStamp": "03-May-2019 11:04:03" } ] An import mapping is a applied as seen below. The output type of the ‘Call Rest’ action is a SnapshotList which as can be seen by the above has many sub snapshot objects. This is then returned to the data view. In the data view I have a drop down but when I try to set the attribute, the only thing showing is a Snapshotlist and I cannot select it as shown below.   Any help at all would be really appreciated. Thanks in advance, Adam.
2 answers

A dynamic dropdown (called a reference selector) in Mendix expects to set an association between one object and another. (FYI, the Dropdown widget is only used for setting the value of an enumeration).

For example, in a typical app, you might have a Product entity and a Categories entity. Each Product may fall into a Category. You’d model this with a many-to-one association drawn from Product to Category, which then you could easily use a Reference Selector to set that reference.

So in your case, your data model has 1 SnapshotList object with many Snapshots. But you’re trying to select a single Snapshot. So, you need to add a new association from SnapshotList to Snapshot, and then use that new association in a Reference Selector widget.




I assume in the REST activity SnapshotList is the receiving object of tha REST call.

Then retrieve Snapshot over association and use that further in the MF.