How to remove duplicates entries from a reference selector?

Hi all, Could anyone please  help me resolve this issue? I have the following situation:   2 entities: Company and Country. The entity country has many contries which belongs to a same continent. I created a page to register the company (company name, address ) and use a reference selector to country and continent. How can I remove these duplicates entries, in other words, how can I get only the distinct continents?     Thank you! André    
1 answers

You do not have duplicate continents, you do have a list of countries, which have a string value for continent, which occurs multiple times. Might sound the same, but it is different.


You have to go one step further with normalizing your data model.

Add an extra entity "Continent" and add a association between the country and the continent. On country refers to one continent, one continent can be referenced by multiple countries. Remove the Continent string from Country.

Add a second association between Company and Continent.


Domain model should look like this


Page to edit the company would look like this



Where you can also constrain the selectable countries by the selected Continent



And ofcourse you need a option to add Continents to your app. And change your Country_NewEdit page, remove the continent string input textbox and replace it with a reference selector where you can select the Continent.