cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pmillar
Level: Powered On

Concat Multiselect Listbox expression error

Hi, I am building a form to save several data pieces to an excel table or sharepoint list.

Part of my form uses a Listbox with "select multiple" enabled. I want to capture all of user selected items as a single string (comma or semi colon separated) so that I can feed it back to the sharepoint list or excel table later with my "collect/patch" command.
Normally this is a simple operation with the concat command but I can't get it to work here.

The listbox is called “List_Yrkessarbetare”.
Concat(List_Yrkessarbetare.SelectedItems.Value, Concatenate(Text(Value),","))

The above should return a string with all selected values from the listbox but it generates errors. I have tried this in a fresh app with the sample data for a listbox and I can easily concat those values to return a single comma separated string as expected - I believe it must be something to do with how the options for my listbox are generated causing a problem.

The possible listbox values are dependent on the result of a dropdown which the user selects on a previous page. (Basically they select a Shift manager, this then sets the possible listbox values to only the staff members assigned to that shift manager by filtering an excel data table).

"Filter(Personallista, Chef = Dropdown_chef.Selected.Result)"
The above generates the listbox values based on the users choice from the dropdown, “Dropdown_chef”.

Any other members have any ideas what’s going on please?

1 ACCEPTED SOLUTION

Accepted Solutions
pmillar
Level: Powered On

Re: Concat Multiselect Listbox expression error

Solved this about 5 minutes after posting for help. After struggling for a day with complete fustration haha. 

 

For some reason, I needed to use the "selecteditemstext.value" expression instead of "selecteditems.value".

 

I'm not sure what the technical reason is but it works!

 

Concat(List_Yrkessarbetare.SelectedItemsText.Value, Concatenate(Text(Value),",")) returns exactly as expected. 

View solution in original post

4 REPLIES 4
pmillar
Level: Powered On

Re: Concat Multiselect Listbox expression error

Solved this about 5 minutes after posting for help. After struggling for a day with complete fustration haha. 

 

For some reason, I needed to use the "selecteditemstext.value" expression instead of "selecteditems.value".

 

I'm not sure what the technical reason is but it works!

 

Concat(List_Yrkessarbetare.SelectedItemsText.Value, Concatenate(Text(Value),",")) returns exactly as expected. 

View solution in original post

Anonymous
Not applicable

Re: Concat Multiselect Listbox expression error

Hi @pmillar !

I am trying to do something similar, I believe. I have a form with multiple types of fields that I need to save to my SP with one being a multi select combo box. 

 

Would you be willing to share with me what your submit using patch and collection looks like? I have tried a couple of different methods with no luck.

pmillar
Level: Powered On

Re: Concat Multiselect Listbox expression error

Hi @Anonymous 

 

Sure no problem. 

 

To make things a bit easier with the multiselect box, I actually created a seperate text label (which is set to invisible) to collect the values first so I could confirm its being collected as expected. This is also useful for some formatting so the selected items can be concatenated with commas and spaces to seperate the values, or else you get one long text string with all the selected items together. 

 

My invisible Text Label looks like this: 

Left(Concat(List_Yrkessarbetare.SelectedItemsText.Value,Concatenate(Text(Value),", ")),Len(Concat(List_Yrkessarbetare.SelectedItemsText.Value,Concatenate(Text(Value),", ")))-2)

 

This gathers the selected values from the multi select box into a single text value seperated by commas, the "-2" at the end removes the trailing space and comma which is left over. 

 

E.g for a multi select box:

  1. Item 1 
  2. item 2
  3. item 3 

If all 3 items are selected this generates the value "item 1, item 2, item 3" neatly in a single text box which is then simple to patch. 

 

My Patch looks like this (text box above is highlighted red): 

Patch(
Diary_Table,
Defaults(Diary_Table),
{
Företag: Dropdown_företag.Selected.Result,
Arbetsledare: Dropdown_chef.Selected.Result,
Yrkesarbetare: Label_YA_invisible.Text,
Form: Slider_Form.Value,
}
)

 

Hopefully that helps, let me know if you have questions. 

Highlighted
Akshaypanjwani
Level: Power Up

Re: Concat Multiselect Listbox expression error

I am facing issue in patch function for multi select option column in entity in CDS.

I am using below function to concatenate all selected value from multi-select control.
As seen below.

 
 

But when i do patch it will show error.
Capture2.PNG

Please help me It's urgent
thanks in advance.

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 (4,440)