Remove Item from Association List

Hello Cuba community,

I’m trying to find a solution to the following situation:

People entity created for use as an association.
Activity entity created which has two “People” association drop down selections.

In the activity edit screen, when one “people” field is selected, remove that selection from the other “people” field. If changed, restore the list and remove the newly selected.

Is there a way to do this? I haven’t been able to find the solution yet.

Thanks all,
Adam

Hi.
Could you please provide more information about your problem? Which type of association do you use? Do you have two attributes associated with People in Activity entity? If it is possible, could you share a small project in order to help us investigate the problem?

Regards,
Natalia

Yes, of course. I’m sorry. In my example project, there is a Player entity and a Game entity. The Game entity contains two attributes as Many-to-One associations to the Player entity. Both attributes contain the same list of “Players”, just with separate data containers.

I’m including the sample project:
chessgames.zip (286.5 KB)

Hopefully I created the gradle zip file correctly.

Let me know if you need anything from me. None of this is proprietary; I’m just creating a test project trying to figure out how to do this exercise.

Basically, I don’t know the proper way to modify the BlackPlayersDc CollectionContainer when the whitePlayerField is changed via something like this:

@Subscribe("whitePlayerField")
    public void onWhitePlayerFieldValueChange(HasValue.ValueChangeEvent<Player> event) 
        if (!whitePlayerField.isEmpty()) {
            List blackPlayers = blackPlayersDc.getItems(); //This won't work
            // further manipulation of the blackPlayersDc 
        }
    }

And the same for the whitePlayersDc when the blackPlayerField value is changed. I just can’t seem to figure out the proper way to interact with the data containers.

Thanks again,
Adam