Firstly, my thanks for the inspiration for this to @RezaDorrani in his great video.
I thought I would take this a couple of stages further with: -
A short example of it working is below
Firstly, if the code seems a little over-complex, it is due to some refreshing issues I had in testing and the below seems to work as intended. It is based off a test list of PC devices, but can be applied to any similar structure.
As I mentioned, the primary radio control is stored in a Text field. For the secondary filtered item, create a Choice type column (as below I called mine MultiChoice) and ensure to check allow multiple selections.
The choices can be whatever you want - they will not be used - the "container" is needed to hold the data.
Firstly, the gallery at the bottom of the demo is simply to select the record (as you would normally do). The number is the ID, but this is only to show the records present. The OnSelect of the gallery is
UpdateContext({varItem: ThisItem});
ClearCollect(
colMulti,
varItem.MultiChoice
)
You would also probably add a navigation to your screen here.
The Item of the Form is: -
LookUp(
Devices,
ID = varItem.ID
)
and the OnSuccess
UpdateContext({varItem: Self.LastSubmit});
ClearCollect(
colMulti,
varItem.MultiChoice
)
The Submit Form button simply submits the Form.
SubmitForm(frmMultiBoxes)
Default - shows the Text field stored in the data source in the relevant Radio button: -
varItem.Manufacturer
The Item selects the list of values you want to choose from: -
Sort(Manufacturers.Title,Title)
but will be whatever you need to show the primary list items. The Update of this Data Card - writes the selected item value to the Text field: -
rcManChoice.Selected.Title
The OnChange - important as if another value is selected, any stored values from the second field need to be cleared: -
Clear(colMulti)
Now to the main item - firstly, the DataField of the card in my case is "MultiChoice" - the field created above (which is populated automatically if you insert the card normally).
Next, you need to delete all the controls out of the card and insert a blank Vertical gallery (this is well explained in Reza's video)
The Items of the gallery here are (note I found the pre-filter assisted refreshing): -
With(
{
wDevices: Devices,
wMan: rcManChoice.Selected.Title
},
Filter(
wDevices,
ManufacturerName = wMan
).'Device Name'
)
You will have to apply the list and field names to your model. Next, insert a Check Box into the gallery with the following settings. Text (in my model - it will be your field name).
ThisItem.'Device Name'
The Default -looks for instances of the value chosen in the Multi-Choice field in the data source: -
ThisItem.'Device Name' in colMulti.Value
Again this will be the name of the field you are displaying. Now set the WrapCount of the Gallery (mine is 4) to whatever fits with your field names. Lastly, the Update of the DataCard with the Gallery in it - writes the Collection to the Multi-Choice field in the data source: -
colMulti
This is a relatively complex process and requires the values above modified to your requirements, but if all steps are followed correctly, you should have a working model.