Skip to main content

Notifications

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

*This post is locked for comments

  • MechEng2013 Profile Picture MechEng2013 257
    Posted at
    Saving multi-choice Combo Box in a Text field and displaying chosen items in control - using SubmitF

    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.

  • WarrenBelz Profile Picture WarrenBelz 145,567
    Posted at
    Saving multi-choice Combo Box in a Text field and displaying chosen items in control - using SubmitF

    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)

  • MechEng2013 Profile Picture MechEng2013 257
    Posted at
    Saving multi-choice Combo Box in a Text field and displaying chosen items in control - using SubmitF

    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!

  • NPrice99 Profile Picture NPrice99 1,272
    Posted at
    Saving multi-choice Combo Box in a Text field and displaying chosen items in control - using SubmitF

    Hi

    How do you know when an item has been deselected ?

     

    selectedItems is blank.

     

    Thanks

     

    Nigel