I'm going to assume that [@SMEList].Category
indicates you have a Lookup column of "Category" on "SMEList".
You say you want a collection without using a combo box? Yet, you only want the selected values, so where are these getting selected, if not from a box? Even if you don't want the user to mess with the box, you can set it to disabled, view or visible = false. So I'm going to include that route and then also talk about getting the values from the list, directly.
Combo Box
Concat(ComboBox1.SelectedItems,Value,",")
or it might be:
Concat(ComboBox1.SelectedItems,Category,",")
This would let you pull all selected values together. So it would go:
Collect(myCollection,Concat(ComboBox1.SelectedItems,Value,","));
Collect(myCollection,Concat(ComboBox1.SelectedItems,Category,","));
Or, using the OnChange
of the combo box:
ClearCollect( myCollection, ComboBox1.SelectedItems );
Automatically updating the collection whenever any selected items are changed.
(And in the App's OnStart, do Set(myCollection, [])
as you probably already have.)
Without a combo box
You could also set the list into a collection from the beginning, in the App's OnStart, like:
Set(colList, []);
ClearCollect(colList, [@SMEList])
...and based on an ID, you call to that collection to get its values, like SeaDude demonstrated using a gallery and then he set a combo box using the result, basically the key was: LookUp(colList, ID = varRecord.ID)
Where varRecord
was set to ThisItem
from the list:
Gallery's OnSelect property: Set(varRecord, ThisItem)
...So it sets the item that the gallery was invoking. (And then he set that item equal to the combo box's Items
property using that LookUp
formula, above.)
But that code takes the collection with the list in it and lets you send in an ID and get the whole item, with all of its columns, back out. You can do a lot with a LookUp
command just on its own if you are going against a list directly, and without an ID, too:
ClearCollect(myCollection,LookUp([@SMEList],'Created'<Today()).'Category')
...could potentially grab you every Category
value on that SMEList
that was Created before today. You can use any condition you want (ID equals something, Title equals something, etc.).
Either direction
After you get your collection, you can do a CountRows
on your myCollection
to see how many values it has to see if it matches what you expect:
Notify(CountRows(myCollection), NotificationType.Information)