cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lliu_western
Resolver II
Resolver II

Combo Box Default with Multiple Value from a string

Hello community,

 

I have a Combo box in a form, users are able to select multiple values. 

A string of multiple selected value is created and patch to one SharePoint column. 

 

For example,

in the form, users are able to select fruit items, with choices of [Banana, Apple, Orange]

A string is created and displayed in Button A. Text in Button A: Concat(ComboBox_Fruit.SelectedItems, Value & "; ")

 

Patch formula - patch back to SharePoint list:

Patch('Fruit Record',Defaults('Fruit Record'),{'Fruit': Button A.Text});

 

In the SharePoint, the value is being stored such as:    Banana; Orange

 

There is another App for Administrators where they can view those records and select a record to edit. When an administrator select the record and in the edit form, I need to have the combo box to have a default value of selected items, taking the above example, the default values will be "Banana", "Orange".

 

I have tried using this formula:    Split(Gallery_Display.Selected.'fruit',";")

But this formula gives me a result in a table type. I need help in making the split items into an array format so it can be used in the Default formula,  ["Banana", Orange"]  will be the value for the Default when using the example above. 

 

Any advice is appreciated, thank you. 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Thorpe
Super User
Super User

Try this and since it is in multi select combo box update the formula in DefaultSelectedItems.

 

RenameColumns(Split(Gallery_Display.Selected.'fruit',";"), "Result", "Value")



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

7 REPLIES 7
Jeff_Thorpe
Super User
Super User

Try this and since it is in multi select combo box update the formula in DefaultSelectedItems.

 

RenameColumns(Split(Gallery_Display.Selected.'fruit',";"), "Result", "Value")



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

@Jeff_Thorpe  It worked! Thank you! Not even sure what the RenameColumns function is but will look it up, thank you again! 

Your combo box was expecting a single column table named Value and Splits returns a single column table called Result, so we just needed to change the name.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

@Jeff_Thorpe Worked for me!

anushau_1
New Member

With the rename function i am able to load multiple selected values for combo box. But when the form is opened and submitted without any changes, the previous selected values of combo box are not getting updated to the list

In my multi-select drop-down, I have the following code in the OnChange property:

 

ClearCollect(colOptions,Filter(ShowColumns(colOriginalOptions,"field_Column1_x0020_description","id0"),field_Column1_x0020_description in DataCardValueMultiSelectDropDown_1.SelectedItems.field_Column1_x0020_description))

 


Where the Items property of that multi-select drop-down is:

 

ShowColumns(colOriginalOptions,"field_Column1_x0020_description","id0")

 


Then in the Update property for the parent dataCard of that multi-select drop-down I have:

 

Distinct(Int(ForAll(Sequence(5),Last(FirstN(colOptions,ThisRecord.Value))).id0),id).Result

 

Note, the above code works for a multi-select drop-down with 5 items. Change that "5" to the total number of items in your multi-select drop-down list.

See if you can adapt something like this to your use case @anushau_1 !

This saved my day, thank you Jeff! 😀

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (4,413)