cancel
Showing results for 
Search instead for 
Did you mean: 
WarrenBelz

Saving multi-choice Combo Box in a Text field and displaying chosen items in control - using SubmitForm only

It is well documented how to save the contents of a multi-select combo box to a Single Line of Text field, but not so how to successfully get the content back into the DefaultSelectedItems of the control.

I will do two examples here (both related) - one on a Choice field and the other on a list of items.

 

Choice field

Items

Choices(ListName.FieldName)

Update of Data Card - this also removes the last comma

With(
   {
      wList:
      Concat(
         ComboBoxName.SelectedItems,
         Value & ","
      )
   },
   Left(
      wList,
      Len(wList)-1
   )
)

DefaultSelectedItemsRenameColumns is important here as the control is expecting Value as a property.

RenameColumns(
   Split(
      ThisItem.TextFieldName,
      ","
   ),
   "Result",
   "Value"
)

 

List Field

Next is a list based on a field (it could be in another List) - I will refer to it as ChoiceFieldName below

Items

ListName.ChoiceFieldName

Update of Data Card

With(
   {
      wList:
      Concat(
         ComboBoxName.SelectedItems,
         ChoiceFieldName & ","
      )
   },
   Left(
      wList,
      Len(wList)-1
   )
)

DefaultSelectedItems

RenameColumns(
   Split(
      ThisItem.TextFieldName,
      ","
   ),
   "Result",
   "ChoiceFieldName"
)

and that is about the extent of the process. I hope this is useful to you.

 

 

Comments

Hi

How do you know when an item has been deselected ?

 

selectedItems is blank.

 

Thanks

 

Nigel

I'm trying to use Multi-Select ComboBox to put text into a text column of a Dataverse Table. This code isn't quite working for me, any suggestions for Dataverse Text Columns? Thanks!

Yes - that would be an issue. This article is referring to SharePoint and the column structure in it (Dataverse Option Sets are a quite different structure)

I think for simplicity I will default back to either choices or a lookup column where I know how to set that up. I thought at first that a Text field would be easier to work with, but probably not. Thank you sir.