I have tried different methods to update multiple records in a SharePoint List, with a condition and update a specific column with a value..
I would like to know if Power Apps has a function that is similar to a SQL Update statement, without delegation issues. Those articles I'm reading are more than a year old.
Eg. UPDATE Cities SET Location = CONVERT(Point, '12.3:46.2') WHERE Name = 'Anchorage';
Solved! Go to Solution.
Hi @CalvinHew ,
Yeah, you are right. The UpdateIf function is a non-delegable function in PowerApps. If the amount of your SQL Table records is not more than 2000, you could ignore the Delegation warning issue.
Note: Please make sure you have set the "Data row limit for Non-delegable query" option to maximum value -- 2000
If the amount of your SQL Table records, you could consider bulk-load your SQL Table records into a collection in your app, then use the collection as data source in your app instead of the original SQL Table data source. Please check and see if the following thread would help in your scenario:
In addition, you could also consider use the following formula to update multiple records in your SQL Table:
ForAll(
RenameColumns(Filter('[dbo].[Cities]', Name = 'Anchorage'), "PrimaryKeyColumn", "PrimaryKeyColumn1")
Patch(
'[dbo].[Cities]',
LookUp('[dbo].[Cities]', PrimaryKeyColumn = PrimaryKeyColumn1),
{
Place: "Town"
}
)
)
Best regards,
The Patch() functions modifies or creates a record or set of records, is that what you mean? I have done a lot of SQL so can't fully understand your code. If you explain what your SQL code is doing or what you are trying to achieve I may be able to help?
Hi,
The Patch() functions modifies or creates a record or set of records, is that what you mean? - That's right
My SQL statement selects multiple records based on a condition/filter (WHERE Name = 'Anchorage'), and then update the table Cities, column Place of those records to "Town". (I'm giving another more straight forward eg)
UPDATE Cities SET Place = "Town" WHERE Name = 'Anchorage';
This type of update is a standard SQL function, but Power Apps seems to be lacking. Patch is difficult to update multiple records. UpdateIf has delegation issues.
Thanks.
Hi @CalvinHew ,
Yeah, you are right. The UpdateIf function is a non-delegable function in PowerApps. If the amount of your SQL Table records is not more than 2000, you could ignore the Delegation warning issue.
Note: Please make sure you have set the "Data row limit for Non-delegable query" option to maximum value -- 2000
If the amount of your SQL Table records, you could consider bulk-load your SQL Table records into a collection in your app, then use the collection as data source in your app instead of the original SQL Table data source. Please check and see if the following thread would help in your scenario:
In addition, you could also consider use the following formula to update multiple records in your SQL Table:
ForAll(
RenameColumns(Filter('[dbo].[Cities]', Name = 'Anchorage'), "PrimaryKeyColumn", "PrimaryKeyColumn1")
Patch(
'[dbo].[Cities]',
LookUp('[dbo].[Cities]', PrimaryKeyColumn = PrimaryKeyColumn1),
{
Place: "Town"
}
)
)
Best regards,
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
195 | |
45 | |
45 | |
42 | |
36 |
User | Count |
---|---|
270 | |
81 | |
81 | |
75 | |
69 |