cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

CDS DROPDOWN COLLECTION

Hello,
I would like to create a collection from a drop-down list CDS. Then I wish to add elements to this collection from a dialog box so that these elements displays in the drop-down list.
Is it possible?
How to make. Thank you for your answers

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: CDS DROPDOWN COLLECTION

Hi @hanvol,

 

If you wanted to get the list of unique items from one of the columns already in one of the entities, (say "myentity" ) in your database and show it in your dropdown, Set the OnVisible property of the Screen to collect the unique names for the collection using: ClearCollect(dplexp,distinct(myentity, dipli1Experience). // This will show the unique items in the entity already in your database in a Column called Result.

Set the Items property of the dropdown to Distinct(dplexp,Result). //The user has the option of either selecting an item from the dropdown or using the + button to add a new one.  Using Distinct again on the collection (even though the list is already has unique items), This will prevent the user from adding a duplicate to the collection from your popup. 

To add to the dropdown for items not already in it, when you popup your dialog box with the TextInput box, make your button Collect(dplexp, {Result:Textinput1.Text}). // This will add the new item in the dropdown and it will be at the bottom of the list.  The user can then select it and when you Submit the data from the Form containing the dropdown, the new Item will be added to the underlying entity and will show up the next time you open the form and use the dropdown. There may be other ways to do this but I tested it and it works. 

View solution in original post

1 REPLY 1
Highlighted
Super User
Super User

Re: CDS DROPDOWN COLLECTION

Hi @hanvol,

 

If you wanted to get the list of unique items from one of the columns already in one of the entities, (say "myentity" ) in your database and show it in your dropdown, Set the OnVisible property of the Screen to collect the unique names for the collection using: ClearCollect(dplexp,distinct(myentity, dipli1Experience). // This will show the unique items in the entity already in your database in a Column called Result.

Set the Items property of the dropdown to Distinct(dplexp,Result). //The user has the option of either selecting an item from the dropdown or using the + button to add a new one.  Using Distinct again on the collection (even though the list is already has unique items), This will prevent the user from adding a duplicate to the collection from your popup. 

To add to the dropdown for items not already in it, when you popup your dialog box with the TextInput box, make your button Collect(dplexp, {Result:Textinput1.Text}). // This will add the new item in the dropdown and it will be at the bottom of the list.  The user can then select it and when you Submit the data from the Form containing the dropdown, the new Item will be added to the underlying entity and will show up the next time you open the form and use the dropdown. There may be other ways to do this but I tested it and it works. 

View solution in original post

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,133)