Hi,
I am creating an app that lists tasks of 2 types of shutdown. I am using Patch to update each record as they are completed. What I am trying to do now is essentially 'reset' the sharepoint list for each type of shutdown so that it can be used for the next shutdown.
I am trying to filter the list by shutdown type then patch the Completed column and Task Completed column so that they say false.
So I am filtering a data source by one column, then patching all the records that the filter returns.
This is what I have so far...
ForAll('Pilot TC San', (Patch('Pilot TC San',LookUp('Pilot TC San',Shutdown=Dropdown1.Selected.Result),{Completed:false,TaskComplete:False})))
Dropdown.Selected.Result is the type of shutdown that is to be reset.
I get an error which states 'This Function cannot operate on the same data source that is used in the ForAll function'.
Any help on this would be much appreciated
The UpdateIf worked a treat, thank you. It wasn't a function I was aware of, so I was overcomplicating it by using functions I knew about.
Hi @AllyCrop ,
Could you please share a bit more about your scenario?
Do you want to update the Completed column and Task Completed column of all related records in your data source based on the shutdown type specified within the Dropdown1?
Based on the error message that you mentioned, I think there is something wrong with your formula. You could not specify same data source within the Patch function as that within your ForAll function. I assume that you used a Gallery control in your app to list all records from your SP List, and you connect the Gallery to your 'Pilot TC San' List data source, is it right?
Please modify your formula as below:
ForAll(
Gallery1.AllItems,
Patch(
'Pilot TC San',
LookUp('Pilot TC San',Shutdown = Dropdown1.Selected.Result),
{
Completed: false,
TaskComplete: false
}
)
)
Actually, I think it is not necessary to use ForAll function to achieve our needs, instead, I think the UpdateIf function is enough. Please consider take a try with the following formula:
UpdateIf(
'Pilot TC San',
Shutdown = Dropdown1.Selected.Result,
{
Completed: false,
TaskComplete: false
}
)
Please take a try with above solution, check if the issue is solved.
Best regards,
If the filtering is done in a Gallery or a Collection, the Use the Gallery or Collection name ForAll instead of the table name:
ForAll(CollectionName, (Patch('Pilot TC San',LookUp('Pilot TC San',Shutdown=Dropdown1.Selected.Result),{Completed:false,TaskComplete:False})))