How to use Cascading Dropdown / Reference Selector for more then 1 Entities

Hello Everyone, i want to ask a question that how can i use a cascading dropdown or a reference selectore for more then 1 entity. Like my entity is as shown below so when i view users data it will show me the city, state and country as well whereas when i want to add use it only showing me a City and if i add new reference selector or a dropdown to select state or a Country its not showing me any attribute for State and Country.  whereas what i want is that whenever a user comes to register a new user firstly he will select a country of new user then the states related to selected country will open in the States Drop down and when a user select State then cities related to that states will appear in the cities dropdown and then finally a user can select a city he want.
2 answers

Hi Hamroush,

You can constrain the States and city dropdowns based on your users selections. 

First you would need add associations from Users to State and Country. Then you can prompt your user a question for country, state, and city. When a country is selected, then the state drop down will be constrained, then when a state is selected, the city drop down can be constrained.


With a domain model like this


You can create a form like this



And then on your drop downs for States and City, you can add xpath constraints so that the list is filtered.



Then you can also take it a step further and hide the state question based on if the user has selected a country. 


The same can be done with City.


Then once all that info is saved, you can display Country, state, and City per user. 


Hope this helps!




what should be the data type for the dependency?

Is it enumeration or string type???