Design

Saving and displaying multi-choice Combo Box in a Text field

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
   )
)

DefaultSelectedItems – RenameColumns 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.

2 Comments

  • richard clowes

    Hi Warren…

    Can you just explain in basic 101 language the purpose behind adding this…
    Left(
    wList,
    Len(wList)-1
    )

    as a 2nd question…
    I’m using a SP List and doing my defaultSelectedItems as …
    Filter(TravelSites,Title in ThisItem.TravelSites)
    That seems to work.
    But when I change it to..
    RenameColumns(Split(ThisItem.TravelSites, “;”), “Result”, “Title”)
    it displays nothing.

    I must be misunderstanding your logic.

    • Warren Belz

      Hi Richard, as noted on the forum the first one is just to get rid of the last comma. You are using a different model on the second item (my example was for a Choice field)

Leave a Reply

Your email address will not be published.