cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
geneZebra
Level 8

sharing an easy way to add an item on the fly to a comboBox based on a data source

Note: I tried to post to best practices area but could not see how to label it for the post to go through. If this is in the wrong forum, let me know how to properly post in the correct forum. Thanks.

 

I struggled for some time on how to add a "Create New" and other options to a comboBox's dropdown list. I did not want to create another global collection in application especially since the scope of this entry is only needed in the comobox.

 

I could not really find a way to do this without getting all sorts of data type mismatch errors so if anyone can find a cleaner solution please share.

 

The code below is for the items property in the comboBox. The Split function creates the lists of items from a string. based on a text deliminator. To add the "*Create New" option or any other option to the list, that option is appended to the string along with the deliminator used by Split.  

 

The string used by Split, is a text dump of the list from a table via a function called Concat. I use Distinct and filter to only list unique entries that meet a criteria but Concat creates a string based on the field name and a deliminator. Since I am using Distinct, "Result" is the field name that Concat works on. The key to this solution is to use the same text deliminator by both Split and Concat. That way when Spit runs, it just sees the newly added options as values using the same deliminator.


items: 
Split( "*Create New|" &
        Concat(Distinct(Filter(Budgets,Value(ID) <> 0), OwnerName) ,Result & "|")
        , "|"
)

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: sharing an easy way to add an item on the fly to a comboBox based on a data source

Hi @geneZebra ,

Thanks for your sharing. It is an easy way to add any extra options within a ComboBox.Smiley Very Happy

 

I would also share your solution to my team memebers.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: sharing an easy way to add an item on the fly to a comboBox based on a data source

Hi @geneZebra ,

Thanks for your sharing. It is an easy way to add any extra options within a ComboBox.Smiley Very Happy

 

I would also share your solution to my team memebers.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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
Users Online
Currently online: 188 members 5,546 guests
Please welcome our newest community members: