Hi,
I have a list of items stored in a text-field ("Items") in a collection ("MyCollection"): "Item1, Item2, Item 3"
In order to show these items in a combobox I first split the text and store the items in a collection:
ClearCollect(
colItems;
ForAll(
Split(
LookUp(
MyCollection;
Serialnumber="12345"
).Items;
","
);
{Value: Result}
)
);;
In the DefaultSelectedItems-property of my combobox I have:
colItems.Value
When the screen on which the combobox is located is shown, the text-field Items is being emptied. When I remove the code in the DefaultSelectedItems-property, the string in Items remains as intended.
Why is the DefaultSelectedItems-property removing content from the collection?
Regards
Lukas
Solved! Go to Solution.
Your DefaultSelectedItems property (DSI) needs to be a record (or a table of records if multi-select) that matches the record schema of the Items property.
I am not sure if your intention is to select all of the items in your combobox, or if you even have multi-select on.
Please consider changing your Items property Formula to the following:
RenameColumns(
Split(LookUp(MyCollection; Serialnumber="12345").Items; ",");
"Result"; "Value"
)
You now need to supply a Record to the DSI that is based on this table (a single "Value" column table).
So, {Value: "Item1"} for example, in the DSI would select Item1 in the combobox.
Since I am not sure what your goal is with the selections, I will leave it with that in hope that it provides the information you need. If not, then please elaborate on what you are trying to select in the control.
I hope this is helpful for you.
Your DefaultSelectedItems property (DSI) needs to be a record (or a table of records if multi-select) that matches the record schema of the Items property.
I am not sure if your intention is to select all of the items in your combobox, or if you even have multi-select on.
Please consider changing your Items property Formula to the following:
RenameColumns(
Split(LookUp(MyCollection; Serialnumber="12345").Items; ",");
"Result"; "Value"
)
You now need to supply a Record to the DSI that is based on this table (a single "Value" column table).
So, {Value: "Item1"} for example, in the DSI would select Item1 in the combobox.
Since I am not sure what your goal is with the selections, I will leave it with that in hope that it provides the information you need. If not, then please elaborate on what you are trying to select in the control.
I hope this is helpful for you.
@RandyHayes, thanks!
The combobox (multiselect) gets its items from another collection. The user can now select one or more items and these selected items are stored in MyCollection (as a comma separated string as decribed above plus a unique identifier, in this case Serialnumber).
The user should be able to access the data that was previously stored in MyCollection by selecting a Serialnumber. That's why I would like to use the comma separaetd items in the DSI of the combobox.
Just to double check...you marked my last post as a solution, but I am not sure if you have the solution you need now with your last post.
Are you good now or still having an issue?
@RandyHayes I struggled first but then I realised that all I have to do is to use the term {Value: "Item1"} (as mentioned in your first reply) in a ForAll loop. So yes, I'm good, thanks a lot for your help 🙂