Using a List in a List and dropdownlist
Question
Application Type
Reactive

Hi all

I have a question regarding the following:

The application that Im making has a mainscreen which contains a list of clubs. Within this list I have another list to show the players of the club. The purpose of this screen is only to fill a local list “ClubPlayers” With this list im going to do something else but that is out of scope for this case.

When you enter this mainscreen the local variable "Clubplayers" is filled with only the clubs. See screenshot.


Now you only see the clubs. No players are displayed because the Playerlist from of the local variable is empty.

From the mainscreen you should be able to add a player to the ClubPlayers list(local variable). You can do this by clicking on the Plus Icon and then a popup will appear. This popup contains all the players of the chosen club where you can choose from. If you add a player, the player will be added to  the ClubPlayer list. Now you will see the player also in the mainscreen.

Two questions:

First question:

When you try to add again a player for the same club the dropdownlist will still contain the player you have choosen before. I want that this player will not be shown in the dropdownlist. Only not added players should be shown in the dropdown. How can I achieve this?

Second question:

Later I will also add functionality to remove a player from the Clubplayer list. In this case the player should be shown again when using the popup to add a player. Any ideas?

I also added the OML.

Hopefully someone can help me with this.

Regards,

Listissue.oml

Ok, now I get what you want to achieve. In that case, you'll have to replace the aggregate by a data action, which will allow you to use a SQL element to fetch the players and filter out the ones that were already added.

I'm attaching a copy of your OML with an implementation of this solution.

As for the second question, my implementation already covers it, as you can also see in the attached OML.

Listissue.oml

Hi João,

Currently, the aggregate that fetches players is set to only fetch the players from the selected club. If you only want players that are not from the selected club, you need to change the aggregate's filter to something like this:

Doing this should answer both your questions.

Hi Aurelio,

Thank you for your reply. But thats not what im trying to achieve.

With your solution I will always see players in the dropdownlist that doesnt belong tot he club I selected.

The dropdownlist in the popup should always only contain players related to that club. In case I added a player to the local variable list “ClubPlayers” and I want to add another player I dont want to see the played I added before in the dropdownlist.

Example:

I open the screen. In this case the Clubs are imported in the ClubPlayers local variable list. Now I only see the clubs without any players on the screen.

Now I want to add a player to the club Benfica in the ClubPlayers list.  A popup appears and I can choose Rui Costa or Eusebio (Dont forget that these players already belong to Benfica. If I choose Rui Costa and click on Add,  Rui Costa will be added to the PlayersList of the Clubrecordlist. And will be shown in the list on the mainscreen.

Till here everything works fine. But now I want to add another Benfica player to the list. I open the popup again and the list contains again Rui Costa en Eusebio. But Rui Costa was already added before and I dont want to see him in this dropdownlist.

And the second question:

In case I remove rui costa from the main list, and i want to add another player using the popup. I expect to see rui costa again in the dropdownlist together with Eusebio.

Hopefully this gives you a better understanding of what I try to achieve

Ok, now I get what you want to achieve. In that case, you'll have to replace the aggregate by a data action, which will allow you to use a SQL element to fetch the players and filter out the ones that were already added.

I'm attaching a copy of your OML with an implementation of this solution.

As for the second question, my implementation already covers it, as you can also see in the attached OML.

Listissue.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.