How to populate dynamic content in dependent drop down

0
Hi, I have page as shown below. It is having three drop down Country, States & City.  Also the REST response for Country service is nested as shown below. I want to extract only countries list out from response. Can anyone please let me know solution on this.  My modeler version:7.18.0 Level: Beginner in Mendix development What i want::::: 1) fill country dropdown by calling REST call on load of page. 2) On select of Country , pass county id to REST call to get corresponding states. Fill these states in State drop down.  3)  On select of States, pass state id to REST call to get corresponding Country. Fill these states in Country drop down.    {   "_embedded": {     "continent_types": [       {         "typeId": "123",         "instantiable": true,         "continent": "asia",         "description": "asian peoples",         "scope": "xyz",         "details": [           {             "nick_name": "",             "types": {               "id": "xxxasia",               "name": "asia",               "category": "democracy",               "scope": "private",               "description": "beautiful continent ",               "countries": [                 {                   "name": "india",                   "unit": "I",                   "searchable": false,                   "qualityCode": false,                   "dataType": "DOUBLE",                   "defaultValue": null,                   "length": null                 },                 {                   "name": "vietnam",                   "unit": "T",                   "searchable": false,                   "qualityCode": false,                   "dataType": "STRING",                   "defaultValue": null,                   "length": 50                 }               ],               "etag": 2,               "_links": {                 "self": {                   "href": "https://"                 }               }             }           }         ],         "fileAssignments": [],         "etag": 20,         "_links": {           "self": {             "href": "https://"           },           "parent": {             "href": "https://"           }         },         "id": ""       }     ]   },   "_links": {     "self": {       "href": "https://",       "templated": true     }   },   "page": {     "size": 1000,     "totalElements": 95,     "totalPages": 1,     "number": 0   } }
asked
2 answers
0

Hi Sujit,

How are you opening your page? Are you using the show page button or a microflow button? To accomplish what you want, you would have to use a microflow. Your microflow will either create the object you are using in your dataview or have that object passed as a parameter. Next you would call your rest service and apply the import mapping. Depending on the structure of the import mapping, use retrieve over association to get down to the entity that contains your country information. Next you would use a change activity to set the country name, and then use the show page activity to display your form.

I would also check out the learning modules.

https://learn.mendix.com/

 

Hope this helps!

answered
0

Hi Sujit,

  To make this work, you will need to utilize on-change microflows that use REST services.  Firstly, you will need to know how to use the native REST microflow actions to make a call to get your countries.  Here is the documentation on how to do that as well as an example video:

 https://docs.mendix.com/refguide/consumed-rest-services.

  Using that knowledge, make a REST call, then write a microflow that extracts the country names and creates and commits a Country entity.  Make an association from the entity on that page to Country and use that association to fill a reference selector input widget.  On that input widget, make an on-change microflow that makes another REST call to populate subsequent dropdown values using reference selector widgets.  More information on this can be found in our getting started learning path, specifically this module: 

https://gettingstarted.mendixcloud.com/link/module/94/lecture/719

answered