How to set up two dropdowns within one entity path and selecting different players?

0
Hi all, I'm working on a Mendix table tennis app for our office. One of my entities is Matches. When I create a new match, I want to select one of the players from the database ('’Player name'’ in the entity: Players). I have tried multiple things but I can't get it done.  Current settings: When I open the app now, I can select a player 1 and if i'm filling in Brian, player 2 is automatically filled in with Brian as well. My domain model looks like this: I understand that I'm using the same entity path, but is there a way that I can use players from the same entity path but select different players?  At the end, I want to create a ranking table with player stats with only one playername.  When I create a seperate Player name 1 and Player name 2, i'ts not possible to have accurate player stats because players have not only 1 playername, but can have Player name 1 and Player name. I'm hoping that somebody can help me! Thanks already  
asked
2 answers
4

Hi Patrick,

 

You could create 2 associations between Matches and Players e.g. Matches_PlayersHome and Matches_PlayersAway. You can now use a reference selector for each association.

If you do so, you won't need the playersnames in the Matches entity anymore.

 

Good luck!

 

Kind regards,

Martijn Hingstman

answered
1

Hi Patrick,

 

Right now you are using the same association ‘Matches_Players/Player/Playername’  for both names, while also having only a 1-* association between players and matches. This mean that you are only able to set 1 player per match. That’s why when you select Brian, the other player will be filled with Brian as well.

 

Now to solve this you could make the association ‘Matches_Players’ a *-* association instead of a 1-* association.  Thenm you would need to use a reference set selector instead as well https://docs.mendix.com/refguide7/reference-set-selector

However, I’m not sure if this will work with the impedements you have, but i hope it works out for you.  

 

 

answered