Good Morning all
I currently have a gallery that is serving as a checklist which allows users to complete projects if they are finished. I am currently able to update the SP list I have linked (Has 2 columns, ProjectName, CompleteOrActive). When the user checks the box associated with the project he/she wants to complete it adds the item to a collection called projectsList using this formula:
If(
!IsBlank(Filter(Projects, ProjectName = ThisItem.ProjectName)), Collect(projectsList, ThisItem))
and then I have a submit button which bulk updates the SP list using this formula:
ForAll(projectsList, Patch(Projects, LookUp(Projects, ID = projectsList[@ID]), {CompleteOrActive : "Complete"}))
It works and filters out the check list gallery, removing the projects that are marked as complete from the gallery. Considering the user makes a mistake and wants to undo the selections they have made - I have added a button "Undo" with the formula:
ForAll(projectsList, Patch(Projects, LookUp(Projects, ID = projectsList[@ID]), {CompleteOrActive : "Active"})) - which just re-adds all the projects from the collection to the gallery.
I know there has to be a conditional somewhere that removes items from the collection of checked projects so only the ones that have been selected currently to be re-added - just not sure where that should go or what it should look like
Any help is appreciated - sorry for the novel of a problem lol
Solved! Go to Solution.
I figured it out - for those who are having the same problem I had this is how I fixed it:
CheckBox OnCheck: Add checked item to a collection
If(
!IsBlank(Filter(Projects, ProjectName = ThisItem.ProjectName)), Collect(projectsList, ThisItem)
CheckBox OnUncheck: Remove Item from the collection
Remove(projectsList, ThisItem)
Submit button OnSelect: Loops through collection and modifies my SP list marking project as complete - leaves checked item in collection for Undo function
ForAll(projectsList, Patch(Projects, LookUp(Projects, ID = projectsList[@ID]), {CompleteOrActive : "Complete"}));
Refresh(Projects)
Undo button OnSelect: Loops through collection and modifies SP list to mark the project as Active, removes the item from the list if given field is "Active"
ForAll(projectsList, Patch(Projects,LookUp(Projects, ID = projectsList[@ID]), {CompleteOrActive : "Active"}));
RemoveIf(projectsList, CompleteOrActive = "Active")
I figured it out - for those who are having the same problem I had this is how I fixed it:
CheckBox OnCheck: Add checked item to a collection
If(
!IsBlank(Filter(Projects, ProjectName = ThisItem.ProjectName)), Collect(projectsList, ThisItem)
CheckBox OnUncheck: Remove Item from the collection
Remove(projectsList, ThisItem)
Submit button OnSelect: Loops through collection and modifies my SP list marking project as complete - leaves checked item in collection for Undo function
ForAll(projectsList, Patch(Projects, LookUp(Projects, ID = projectsList[@ID]), {CompleteOrActive : "Complete"}));
Refresh(Projects)
Undo button OnSelect: Loops through collection and modifies SP list to mark the project as Active, removes the item from the list if given field is "Active"
ForAll(projectsList, Patch(Projects,LookUp(Projects, ID = projectsList[@ID]), {CompleteOrActive : "Active"}));
RemoveIf(projectsList, CompleteOrActive = "Active")
Deleted
User | Count |
---|---|
247 | |
103 | |
82 | |
49 | |
43 |