cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
hanvol
Level: Power Up

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
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
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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,242)