Hi @Veblitz, if I understand it correctly you want to only patch the items that are checked.
If none are checked, nothing should be patched. To achieve this we will have to adjust a few things:
(1) OnCheck will add the item to a new collection:
Collect(colSelectedShortList, ThisItem)
(2) OnUnCheck will remove the item from the collection:
Remove(colSelectedShortList, ThisItem)
(3) The OnSelect of your button will be:
//Each selected item in the collection will be updated
ForAll(colSelectedShortList As Main,
Patch(ShortListedRoster, LookUp(ShortListedRoster, ID = Main.ID),
{Role: DropDown5.Selected.Value})
)
Note: If your gallery Items property is ShortListedRoster, your LookUp in the Patch is not needed. You could write the Patch as stated below by just using the record:
//Change the Patch in the ForAll see above
Patch(ShortListedRoster, Main, {Role: Dropdown5.Selected.Value})
(4) You could add some sort of security / validation
If(CountRows(colSelectedShortList) > 0,
//Patch when at least one item is selected
ForAll(colSelectedShortList As Main,
Patch(ShortListedRoster, LookUp(ShortListedRoster, ID = Main.ID),
{Role: DropDown5.Selected.Value})
),
//Show error when nothing is selected
Notify("Please select at least one item", NotificationType.Error, 5000)
)
If this solves your question, would you be so kind as to accept it as a solution.
Thanks!