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. Items referenced as follows
- Text field being written to in the main list – TextField1
- Choices field name being used – ChoiceField1
- SharePoint list name SPList1
- Name of the Combo Box – Combo1
Choice field
Choices(SPList1.ChoiceField1)
Items
Update of Data Card
Concat(
Combo1.SelectedItems,
Value,
","
)
DefaultSelectedItems
Split(
ThisItem.TextField1,
","
)
List Field
Next is a list based on a field from another List) – I will refer to the elements as follows
- Text field being written to in the main list – TextField1
- Second list name – SPList2
- Text field in SPList2 being used as the Items of the drop-down – TextField2
- Name of the Combo Box – Combo1
Items
Sort(
SPList2.TextField2,
TextField2
)
Update of Data Card
Concat(
Combo1.SelectedItems,
TextField2,
","
)
DefaultSelectedItems
RenameColumns(
Split(
ThisItem.TextField1,
","
),
"Value",
"TextField2"
)
and that is about the extent of the process. I hope this is useful to you.
5 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)
Gabriel
This is great I used List Field option and worked just fine.
Thanks.
Shivshankar Pujari
Hello Warren, I tried your 2nd example and it worked for me thank you .
Deborah Shaffer
The second one worked! Yeah! Thank you!