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. 

3 REPLIES 3
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. 

j_rosa
Level: Powered On

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 @j_rosa 

 

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. 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 44 members 4,041 guests
Please welcome our newest community members: