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

ComboBox.SelectedItems.Result to Text field in SP List

  • Inside my power-app I have a form connected to a SharePoint List I control.
  • I have created a ComboBox that gets items dynamically from another SP list.
  • This works, and my ComboBox offers the multiple items choice as expected.
  • The DataCard in which I'm doing this is connected to a text field on my SP List.
  • the Update value of this DataCard is currently only accepting Text values (because connected to the Text field in SP List).
  • ComboBox.Selected.Result is a text value, but only keeps the latest selected choice from the dropdown menu
  • ComboBox.SelectedItems.Result is a table type, hence it's not accepted by the text field in the SP List

How can I pass the multiple selected items to Update, so that final result would be a text field as follows:
"Item1; Item2; Item6" ?


Can I also read it back as "DefaultSelectedItems = [ThisItem.MyField]" ?

PS.
I use a text type for that field because I don't know the possible choices as they may vary in time.

Thank you for any help.

6 REPLIES 6
RandyHayes
Super User
Super User

@PwrOf3

Try changing your Update property for that datacard to the following formula:

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

 That will give you the concatenated list with semicolon separation.  Keep in mind that this will end with a semicolon.  (i.e. "Item1; Item2; Item6;")

If you wish to exclude that you can change your formula to the following:

Left(Concat(ComboBox.SelectedItems, Result & ";"), Len(Concat(ComboBox.SelectedItems, Result & ";"))-1)

This will perform the concat twice, once to get the length and the other to trim it by 1 (the trailing semicolon).

If you want, you can also use the With function for this - change formula to the following:

With({cList: Concat(ComboBox.SelectedItems, Result & ";")}, 
   Left(cList, Len(cList)-1)
)

 

All of the above should give you what you are looking for.

 

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!

Hi, I'm trying something similar;

 

I have one variable Set(_Fechas,"") where I want to store days of the month like "01;02;03;...."

I have a text label with _Fechas on it's Item property.

 

But whenever I try to patch the SelectedItems Table to a String variable using this formula, I got an error that says:

"Issue: Invalid argument type. Expecting one of the following: Text, Number, Boolean, OptionSetValue, ViewValue"

Any idea?

RandyHayes
Super User
Super User

@OSBSoto 

The properties you named don't make sense as things like text labels don't have Items properties.

Perhaps supply the formula you are having problems with and the property and control you are putting it in?

_____________________________________________________________________________________
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!

I mean, I have a Combobox with multiple value available for selection; numbers from 01 to 31. I want to allow my users to pick as much numbers as they want from the ComboBox; BUT I will store them all together in a Sharepoint List as a single-line field.

 

I am struggling trying to put all the values selected on the ComboBox into a single variable (for the purpose I had been trying to store the ComboBox.SelectedItems inside a Set variable; which also work as the Item for another field on the EditForm.

 

Hope to make myself clearer this time.

RandyHayes
Super User
Super User

@OSBSoto 

You don't need a variable for this in any way.

Just use this formula in your Update property of the form for the column you are setting:

   Concat(yourCombobox.SelectedItems, Value & ";")

 

For the DefaultSelectedItems property of the combobox, set the formula to:

   RenameColumns(Filter(Split(ThisItem.yourColumnName, ";"), !IsBlank(Result)), "Result", "Value")

 

_____________________________________________________________________________________
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!
OSBSoto
Advocate II
Advocate II

Thanks, worked.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,600)