cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MPayne-94
Helper I
Helper I

Convert ComboBox SelectedItems value to text with no predefined choices

I have a combobox that pulls its choice values from a different SharePoint List based on selections made in another field. From this I have not been able to properly Concat the SelectedItems values into text. I have tried the option of

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

but this isn't working as the picture shows, the output is shown as "Result" not "Value". Doing the same Concat with "Result" also does not work.

 

Any ideas? Photos of my work below:

If(DataCardValue217.Selected.Value="SUPER GROUP",Distinct(Filter('SOURCE',Title=Dropdown1.Selected.'Supplier Name').'Corp Product Super Group Name','Corp Product Super Group Name'),If(DataCardValue217.Selected.Value="PRODUCT GROUP",Distinct(Filter('SOURCE',Title=Dropdown1.Selected.'Supplier Name').'Corp Product Group Name','Corp Product Group Name'),If(DataCardValue217.Selected.Value="SUB GROUP",Distinct(Filter('SOURCE',Title=Dropdown1.Selected.'Supplier Name').'Corp Product Sub-Group Name','Corp Product Sub-Group Name'),[""])))
1 ACCEPTED SOLUTION

Accepted Solutions

@RandyHayes  So that didn't exactly work either as I got an additional error message so I tried putting my solution attempt and yours together resulting in (replacing my "[""]" with your "{Result:""}": 

 

If(DataCardValue217.Selected.Value="SUPER GROUP",Distinct(Filter('SOURCE',Title=Dropdown1.Selected.'Supplier Name').'Corp Product Super Group Name','Corp Product Super Group Name'),If(DataCardValue217.Selected.Value="PRODUCT GROUP",Distinct(Filter('SOURCE',Title=Dropdown1.Selected.'Supplier Name').'Corp Product Group Name','Corp Product Group Name'),If(DataCardValue217.Selected.Value="SUB GROUP",Distinct(Filter('SOURCE',Title=Dropdown1.Selected.'Supplier Name').'Corp Product Sub-Group Name','Corp Product Sub-Group Name'),{Result:""})))

 And with a Concat function of 

Concat(ComboBox1.SelectedItems,Result & "; ")

it is working perfectly now! Thank you so much for the help!

View solution in original post

6 REPLIES 6
RandyHayes
Super User
Super User

@MPayne-94 

You are using the Distinct function in your items property.  Therefore your records will have a single column called Result.

Change your formula to the following:

 

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

 

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes Yes I gave that a try when I realized my output was going to be a "Result" with the Distinct function. The error I kept getting was "Name isn't valid. The identifier isn't recognized" on Result in the Concat function

RandyHayes
Super User
Super User

@MPayne-94 

So, let's get your Items property cleaned up so that PowerApps is not getting conflicting schemas.  

Change your Items formula to the following:

If(IsBlank(DataCardValue217.Selected.Value), 
    {Result:""},
    Distinct(
        Filter('SOURCE', Title=Dropdown1.Selected.'Supplier Name'),
            Switch(DataCardValue217.Selected.Value,
               "SUPER GROUP", 'Corp Product Super Group Name',   
               "PRODUCT GROUP", 'Corp Product Group Name',
               "SUB GROUP", 'Corp Product Sub-Group Name'
            )
        )
    )
)

This will make sure that we are getting the same schema.  Your original formula was returning a [""] if none of the conditions were met.  When you do [""] you end up with a table that has a single column called Value with an empty value.  Your Distinct functions are all going to return a table with a single columns called Result. 

These type of things confuse PowerApps as it is not allowed - so best to keep the schemas consistent. 

 

So, plug that in and then let's see where that leads us for the concat function. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes  So that didn't exactly work either as I got an additional error message so I tried putting my solution attempt and yours together resulting in (replacing my "[""]" with your "{Result:""}": 

 

If(DataCardValue217.Selected.Value="SUPER GROUP",Distinct(Filter('SOURCE',Title=Dropdown1.Selected.'Supplier Name').'Corp Product Super Group Name','Corp Product Super Group Name'),If(DataCardValue217.Selected.Value="PRODUCT GROUP",Distinct(Filter('SOURCE',Title=Dropdown1.Selected.'Supplier Name').'Corp Product Group Name','Corp Product Group Name'),If(DataCardValue217.Selected.Value="SUB GROUP",Distinct(Filter('SOURCE',Title=Dropdown1.Selected.'Supplier Name').'Corp Product Sub-Group Name','Corp Product Sub-Group Name'),{Result:""})))

 And with a Concat function of 

Concat(ComboBox1.SelectedItems,Result & "; ")

it is working perfectly now! Thank you so much for the help!

Disregard: user error

 

In the case that the Items for the combo box items are derived from a list defined in the app, how would you refer to it?

 

my combo box items are equal to:

 

Items = [BrowseGallery.Selected.Field1, BrowseGallery.Selected.Field2]

 

 

I've tried using 'Result' , 'Value', 'Item', and 'Items' in place of 'Result' as shown in your solution but none of these work. Since there is no column name, how should the items be referred to, to get the selected items converted to text?

RandyHayes
Super User
Super User

@micross 

If that is your items property, then it is a table with a single column called Value.

Any time you use the square bracket table shortcut, it will create a table with a single column called Value.

If you are having issues with what you are using, then first, I'd recommend putting in a new post on the forum with the problem, and in it, describe what Field1 and Field2 are in your gallery.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,829)