So I'm super stuck. I have a gallery that contains checkboxes and is connected to SP list A. When a box is checked, I add the checked item to a collection:
If(
!IsBlank(
Filter(
'Project Time System',
Project = ThisItem.Project)), Collect(submitProjects,ThisItem), RemoveIf(checkedProjects,IsBlank(Checkbox3)))
When the user presses a submit button - the information from the collection is patched (new record created) into another SP list SP List B using:
ForAll(
Collection,
Patch(
SPList,
Defaults(SPList),
{
Columns and values....
}
)
)
Everything works great, however - I'm stuck on once a record is added to SP List B, I would like to remove it from SP List A which will remove it from the gallery AND I want to remove it from the collection. This should be able to submit all checked items from the gallery at the same time. Any help is really appreciated - like I said - suuuuuppperrrr stuck =o)
Solved! Go to Solution.
Hi @Anonymous ,
Do you want to remove the record from your List A and submitProjects collection when you submit the record into your List B?
Based on the needs that you mentioned, I think the RemoveIf function could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:
Set the OnSelect property of the "Submit" button to following:
ForAll(
submitProjects,
Patch(
'B List',
Defaults('B List'),
{
ProjectColumn: submitProjects[@Project],
...
}
)
);
Refresh('B List');
RemoveIf('A List', Project in 'B List'.ProjectColumn); // Remove records from List A
RemoveIf(submitProjects, Project in 'B List'.ProjectColumn) // Remove records from colletion
Note: I assume that the Project column is a Primary column in your ListA. The Project column value from ListA would be saved into the ProjectColumn in ListB.
Please consider take a try with above solution, check if the issue is solved.
Best regards,
@Anonymous
Where are you stuck? Are you able to remove it? You can remove it using Remove or RemoveIf
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-remove-removeif
Please give more details where you are stuck.
The Remove/RemoveIf (from the SharePoint list) could go in as part of your ForAll statement. Then recreate your collection after the ForAll has completed (if you gallery, that you are iterating through in the ForAll, is based on a local collection, I don't think you can modify that collect, by removing items, while in the ForAll loop).
Hi @Anonymous ,
Do you want to remove the record from your List A and submitProjects collection when you submit the record into your List B?
Based on the needs that you mentioned, I think the RemoveIf function could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:
Set the OnSelect property of the "Submit" button to following:
ForAll(
submitProjects,
Patch(
'B List',
Defaults('B List'),
{
ProjectColumn: submitProjects[@Project],
...
}
)
);
Refresh('B List');
RemoveIf('A List', Project in 'B List'.ProjectColumn); // Remove records from List A
RemoveIf(submitProjects, Project in 'B List'.ProjectColumn) // Remove records from colletion
Note: I assume that the Project column is a Primary column in your ListA. The Project column value from ListA would be saved into the ProjectColumn in ListB.
Please consider take a try with above solution, check if the issue is solved.
Best regards,
Thank you for the responses everyone - I am going to mark this as the solution - the way I figured it out is a little different:
ForAll(
submitProjects,
Patch(
Project_Time_Master,
Defaults(Project_Time_Master),
{
Title: Title,
WeekStarting: WeekStarting,
Project: Project,
Task: Task,
Monday: Monday,
Tuesday: Tuesday,
Wednesday: Wednesday,
Thursday: Thursday,
Friday: Friday,
Saturday: Saturday,
Sunday: Sunday
}
)
);
Refresh('Project Time System');
ForAll(
submitProjects,
Remove('Project Time System', LookUp('Project Time System', ID = submitProjects[@ID])));
RemoveIf(submitProjects, Project in Project_Time_Master.Project)
If you see anything wrong with this or if it might fail as the list gets large (this is going to be for keeping track of time spent on projects for an entire department) please respond
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
184 | |
53 | |
50 | |
36 | |
35 |
User | Count |
---|---|
271 | |
91 | |
82 | |
76 | |
75 |