cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate IV
Advocate IV

Convert combo box selected items into a string

I'm trying to send the selected items in a combo box to a string for output. I know I can out individual selected items several different ways but I can't figure out how to convert all of them into one contiuous string.

I can show the first;

First(ComboBox1.SelectedItems).Title

Or the last;

Last(ComboBox1.SelectedItems).Title

And I can find the number of selected items;

CountA(ComboBox1.SelectedItems.Title)

But how do I get the first last and everything in between?

1 ACCEPTED SOLUTION

Accepted Solutions
Advocate IV
Advocate IV

I found the answer

Concat(ComboBox1.SelectedItems, Title & ", ")

View solution in original post

18 REPLIES 18
Advocate IV
Advocate IV

I found the answer

Concat(ComboBox1.SelectedItems, Title & ", ")

View solution in original post

Helper IV
Helper IV

hi 

I tried to use Combobox.selected.value. But its giving me error on the text box and not populating what ever i select on combo box.

When i use combobox.selected.Result i was only able to get one value populated into thetext box.

Any ideas to fix this would help.

Thanks,

MK

Helper IV
Helper IV

hi

I tried to use Combobox.selected.value. But its giving me error on the text box and not populating what ever i select on combo box.

When i use combobox.selected.Result i was only able to get one value populated into thetext box.

Any ideas to fix this would help.

Thanks,

MK

It would appear from what you typed that you are not using the correct key property. For a multi-select combo box you would use Combobox.SelectedItems, not Combobox.selected.value.

When you use Combobox.SelectedItems you are referring to a table of records not values, so you need to still reference which value(column) from each record you want as a result. In my example I was wanting to combine the Title column from the selected records, therefore my formula was like this.

Concat(ComboBox1.SelectedItems, Title & ", ")

Hope this helps.

Brian

 

 

Hi @Brian_,

 

I tried to use 

Concat(ComboBox1.SelectedItems, Title & ", ")

But,In my scenario I'm filtering combobox values based on Another dropdown

Dropdown1:

Filter('Data Sources',Product.Value="XXXX") 

so, dropdown1 will have 3 products(A,B,C)

When a user selects B  product, it will populate other combobox with its product values.

On Combobox i'm using a lookup column which is releated between datasurce1 and datasource2. And I'm filtering the product values into combobox.

Distinct(Filter(Datasource2,Details.Id=Datasoruce.Selected.ID),ProductValues)

So, now when i select multiple product values form Combobox it should populate another texbox with these details.

 Concat(ComboBox.SelectedItems, ComboBox.Selected.Result & ", ")

when i do this whatever i select first is populating multipletimes into the textbox.

can you help me with this scenario.

Sorry, it's been a long day and I need to look at this when I'm fresh but I did notice you are referring to one selected item in your formula, which is why you are getting the repeating result in the textbox.

 Concat(ComboBox.SelectedItems, ComboBox.Selected.Result & ", ")

ComboBox.Selected.Result refers to one particular selected item, not a column from the table of results.

In this 

Concat(ComboBox1.SelectedItems, Title & ", ")

"Title" refers to a column, not any particular selected item. You need to refer to a column in the reults of the selected items.

For example if you ComboBox records which you are selecting from contain the columns "ID", "Product", and "ProductValues" your formula may look like any of these;

Concat(ComboBox1.SelectedItems, ID & ", ")
Concat(ComboBox1.SelectedItems, Product & ", ")
Concat(ComboBox1.SelectedItems, ProductValues & ", ")

 

So I had a thought this morning. If you aren't sure what fields you have to choose from to put in place of where I had "Title", do this.

Add a Data Table to the screen where the combobox is temporarily and set the data source as the combobox.SelectedItems

Once you've selected an item you can go to the DataTable and see a selection of fields that are available to populate the table.

Hope this helps.

Brian

Well done, @Brian_

Impactful Individual
Impactful Individual

@Brian_thanks for this (I found it in a search for exactly the same question). Do you know how to strip off the trailing comma?

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (93,814)