How to remove duplicates entries from a reference selector?

0
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é    
asked
1 answers
1

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

image.png

Page to edit the company would look like this

image.png

 

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

image.png

 

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.

answered