I have a form called "Tasks". Within that the user can select the date and their name and then see checkboxes within a gallery populated with tasks assigned to them for that date (see attached screenshot).
My goal is for people to check off tasks as they do them and send them to a single Sharepoint cell. Currently, tasks are sent to a collection called "CollectTasks" when they are clicked and then they are submitted to the Sharepoint list.
For the Screen I set the "OnVisible" to: UpdateContext({myTasks: Gallery3.Selected.Value})
For the Checkboxes I have their "Default" set to: If(ThisItem.Value in CollectTasks, true, false)
The "OnCheck" is set to: Collect(CollectTasks, ThisItem.Value); UpdateContext({myTasks: Concat(CollectTasks, Value & ",")})
The "OnUncheck" is set to: RemoveIf(CollectTasks, Value=ThisItem.Value); UpdateContext({myTasks: Concat(CollectTasks, Value & ",")})
Finally, I have a form submit button where the "OnSelect" is set to: Patch(Tasks_V2, LookUp(Tasks_V2, DueDate= DataCardValue13.SelectedDate && AssignedTo.Value=DataCardValue17.Selected.Value), {Title: User().Email, CompletedTasks: myTasks, CompletedDateTime: Now()})
The problem is: if I add to the "OnVisible" screen property to clear the collection, the checkboxes aren't checked when the user goes to a different screen and then returns. However, if I leave things as they are and swap between users, checkboxes stay checked but then tasks from multiple users are patched to the same Sharepoint row whereas I need each person to have their own row (see screenshot).
Is there a way to have checkboxes stay checked for each user that I haven't figured out? I considered adding code to my patch statement to include a "Status Completed" column but as everything is a single row, the "Status Completed" might say "True" after one task is patched and other tasks still need to be done.