cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lesotho_kid
Helper II
Helper II

Update formula when trying to write all values of a multi-select combo box

Hello,

 

I have a multi-select combo box called "cmbTaxContacts". 
I want to write the results of that combo box into the database.  Ok if there are multiple results concatenated - i.e. "John Smith; Sally Jones; Jane Doe"
What does the Update formula of the card (which contains this combo box) need to be?  
Trying:

cmbTaxContacts.SelectedItems

But getting an error.
Appreciate any assistance you can provide.
 
Thanks,
Dan
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @lesotho_kid ,

You just need

Concat(
   cmbTaxContacts.SelectedItems, 
   DisplayName & ","
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

6 REPLIES 6
WarrenBelz
Super User III
Super User III

Hi @lesotho_kid ,

This depends on what type of field you are writing back to in the data and the Items of your drop-down. For a Choice Field in the data and the combo box source Choices(something) 

{Value:Concat(cmbTaxContacts.SelectedItems, Value & ",")}

There are a whole lot of other possibilities depending on these two things.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Thanks @WarrenBelz 

 

I'm writing back to a SQL Server VARCHAR field.  And the values are regular text fields.
Tried setting Update =

{Value:Concat(cmbTaxContacts.SelectedItems, Value & ",")}
 
But getting an error saying 'Expect Text value.'
 
You've helped me with several other questions before.  Always appreciate your help.
 
Thanks,
Dan

Hi @lesotho_kid ,

Yes it will as my example was back to a complex field type.

You simply need

Concat(cmbTaxContacts.SelectedItems, xxxx & ",")

where xxxx depends on the Items property of the control.

When you type YourControlName.Selected. (note second dot), valid values will come up underneath. For some guidance of what they mean: -

  • If your Items are Choices(ListName.FieldName) - a Choices or Lookup field), the reference will be YourControlName.Selected.Value
  • If they are Distinct( . . .  .), it will be YourControlName.Selected.Result
  • The other option is when they are based on a field value in a list (other than Distinct), then it will be YourControlName.Selected.FieldName (actual field name)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Thanks @WarrenBelz - appreciate the detailed answer.  The code is now not throwing errors.  But, when I run it and load to db it does not load the correct data.  It will load the first selected item n times - where n is the number of selections by the user.  i.e.  If user selects: John Smith, Mary Jones, Jane Doe.  Then the db will display John Smith, John Smith, John Smith.  Update code below.

Thanks,

Dan

Concat(cmbTaxContacts.SelectedItems, cmbTaxContacts.Selected.DisplayName & ",")

 

Hi @lesotho_kid ,

You just need

Concat(
   cmbTaxContacts.SelectedItems, 
   DisplayName & ","
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Thanks @WarrenBelz 

You are a Power Apps wiz!

 

Thanks for your help!

Dan

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (54,291)