cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
narayanareddy_g
Frequent Visitor

How to retrieve values from the collection and set to a variable?

Dear all, 

I have a requirement to read combo box multiselected values and save them to a text box and the values are separated by a comma (,). Please advise how shall I achieve this? Thank you for your help and support.

My Approach - 

I tried to store the combo box selected values into a collection object like below -

Collect(Prodcollection, Comb0BxProducts.SelectedItems);

On select combo box event, I want to read all all the combo box selected values from the collection and set to a new variable with values separated by comma (,). This variable I will assign to a text box default property.

My question is how to read the values from collection and separate them with comma(,) and set to a a new variable?

2 ACCEPTED SOLUTIONS

Accepted Solutions
One
Super User
Super User

if you want to use the values from the combobox directly you can try the following:

Concat(YourComboboxName.SelectedItems, yourColumnName, ",")

------------------------------------------------------------------------------------------------------------------------------
Please click "Accept as Solution" if this post answered your question so that it is helpful for people having similar questions. If you found this post helpful smack that Thumbs up button! Thanks!

View solution in original post

One
Super User
Super User

@narayanareddy_g ,

that statement doesn't concat 2 fields. column name is meant to be the column you are using in your combobox to retrieve values. it just concats the values selected in your combobox with a "," delimiter 

------------------------------------------------------------------------------------------------------------------------------
Please click "Accept as Solution" if this post answered your question so that it is helpful for people having similar questions. If you found this post helpful smack that Thumbs up button! Thanks!

View solution in original post

6 REPLIES 6
One
Super User
Super User

if you want to use the values from the combobox directly you can try the following:

Concat(YourComboboxName.SelectedItems, yourColumnName, ",")

------------------------------------------------------------------------------------------------------------------------------
Please click "Accept as Solution" if this post answered your question so that it is helpful for people having similar questions. If you found this post helpful smack that Thumbs up button! Thanks!

narayanareddy_g
Frequent Visitor

Hi,

I do not want to concatenate two fields, but rather I want to have combo box selected values concatenated by a comma. For example, if combo box shows Product1 and Product 2 as selected values,

then I want result as Product 1, Product 2 (the values Product 1 and Product 2 are to be separated by a comma)

One
Super User
Super User

@narayanareddy_g ,

that statement doesn't concat 2 fields. column name is meant to be the column you are using in your combobox to retrieve values. it just concats the values selected in your combobox with a "," delimiter 

------------------------------------------------------------------------------------------------------------------------------
Please click "Accept as Solution" if this post answered your question so that it is helpful for people having similar questions. If you found this post helpful smack that Thumbs up button! Thanks!

Thank you so much, it is working perfectly now. I appreciate your help and support. Many Thanks again!

Though it works, it throws me an error as shown in the below screenshot. Please advise.

 

narayanareddy_g_1-1655550061514.png

 

I am very sorry, please ignore this error message. This was due to some other control. I misunderstood. No issues with the solution provided by you. Thank you so much and my apologies. 

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.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

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