cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate V
Advocate V

is UpdateIf delegable or not?

hello everyone,

 

Is the UpdateIf function delegable or not, with a SharePoint List datasource?

 

This says UpdateIf is not delegable:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview#non-delegable-funct...

 

This says UpdateIf is not delegable:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-update-updateif#dele...

 

This says UpdateIf can be used on a Excel data source

https://powerusers.microsoft.com/t5/General-Discussion/Updating-child-status-fields/m-p/268330#M7840...

 

and i just tested it with a SharePoint list data source, set the Non-Delegable Function limit to 1 (in the PowerApp editor), and confirmed that UpdateIf *appears* to be delegable.

(i'm trying not to get to excited just yet, incase i've done something wrong)

 

====

can somone confirm if UpdateIf is now delegable, and the MS Docs are just out of date... or is UpdateIf definetly not delegable still?

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Power Apps
Power Apps

Re: is UpdateIf delegable or not?

I can confirm that UpdateIf is still not delegable.

View solution in original post

Highlighted
Power Apps
Power Apps

Re: is UpdateIf delegable or not?

I ran a test (see details below), and it seems like UpdateIf evaluates the condition against whatever is cached locally. Notice that this is the current behavior and you shouldn't rely on it, as if / when UpdateIf is updated to support delegation, the outcome will be different.

Here are the steps in the test:

Create a table in SQL:

CREATE TABLE deleteme20190522 (
	Id INT IDENTITY PRIMARY KEY,
	Value1 INT,
	Value2 INT
)

Add 10000 items to the table, where Value1 going from 1 to 10000, and Value2 going from 1 (items from 1-2999), 2 (items 3000-5999), 3 (items 6000-8999) or 4 (items 9000-10000):

DECLARE @id INT
SELECT @id = 1
WHILE @id >=1 and @id <= 10000
BEGIN
    INSERT INTO deleteme20190522 (Value1, Value2) VALUES (@id, @id / 3000 + 1)
    SELECT @id = @id + 1
END

Then created a new app, added a button with the following OnSelect expression:

UpdateIf('[dbo].[deleteme20190522]', Value2 = 1, { Value1: 0 })

If UpdateIf were delegated to the server, it would update the first 2999 items in the table to set the Value1 to zero. However, after hitting the button, and executing this on the SQL Server:

SELECT COUNT(*) FROM deleteme20190522 WHERE Value1 = 0

It only returned 500 (which is the default value for the data row limit for non-delegated queries.

You'll get a similar result in SharePoint (I did for SQL because it was quicker for me to add many rows to a new table).

View solution in original post

12 REPLIES 12
Highlighted
Dual Super User II
Dual Super User II

Re: is UpdateIf delegable or not?

Remember there are no delegable functions for Excel, everything is non-delegable.  So the fact that you can use it there doesn't mean its delegable in SharePoint. In terms of your test.  I'm not sure decreasing the limit to 1 will really work and force it to enforce delegation. So all in all, I would have to go with the documentaion and say that UpdateIf is non-delegable but will work with SharePoint lists that are less than 500 items.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Power Apps
Power Apps

Re: is UpdateIf delegable or not?

I can confirm that UpdateIf is still not delegable.

View solution in original post

Highlighted
Advocate V
Advocate V

Re: is UpdateIf delegable or not?

hey @Pstork1 

my sharepoint list currently has 10,244 items.

the updateif function just updated list items 10,016 + 10,017 + 10,018 + 10,019 + 10,020.

my limit of non-delegable records is set to 1 in the powerapp menu.

 

i'm confused why/how this has worked.

---

when the 500 list items are loaded into the datasource (in powerapps), in which order are the items loaded? (ie. the most recent SP List item first by created date, or by first id's 0-500, or something else?)

 

i'm going to try the same test on items 5,001 + 5,002 + 5,003 and see what happens.
those records are >500 items away from either end of the data source.. so i am expecting UpdateIf to fail to update these records, as it is non-delagable.

Highlighted
Advocate V
Advocate V

Re: is UpdateIf delegable or not?

"i'm going to try the same test on items 5,001 + 5,002 + 5,003 and see what happens."

these items were updated successfully.

hmm.. maybe this has something to do with the order in which records are copied into the Datasource?

 

Highlighted
Power Apps
Power Apps

Re: is UpdateIf delegable or not?

I ran a test (see details below), and it seems like UpdateIf evaluates the condition against whatever is cached locally. Notice that this is the current behavior and you shouldn't rely on it, as if / when UpdateIf is updated to support delegation, the outcome will be different.

Here are the steps in the test:

Create a table in SQL:

CREATE TABLE deleteme20190522 (
	Id INT IDENTITY PRIMARY KEY,
	Value1 INT,
	Value2 INT
)

Add 10000 items to the table, where Value1 going from 1 to 10000, and Value2 going from 1 (items from 1-2999), 2 (items 3000-5999), 3 (items 6000-8999) or 4 (items 9000-10000):

DECLARE @id INT
SELECT @id = 1
WHILE @id >=1 and @id <= 10000
BEGIN
    INSERT INTO deleteme20190522 (Value1, Value2) VALUES (@id, @id / 3000 + 1)
    SELECT @id = @id + 1
END

Then created a new app, added a button with the following OnSelect expression:

UpdateIf('[dbo].[deleteme20190522]', Value2 = 1, { Value1: 0 })

If UpdateIf were delegated to the server, it would update the first 2999 items in the table to set the Value1 to zero. However, after hitting the button, and executing this on the SQL Server:

SELECT COUNT(*) FROM deleteme20190522 WHERE Value1 = 0

It only returned 500 (which is the default value for the data row limit for non-delegated queries.

You'll get a similar result in SharePoint (I did for SQL because it was quicker for me to add many rows to a new table).

View solution in original post

Highlighted
Advocate V
Advocate V

Re: is UpdateIf delegable or not?

"UpdateIf evaluates the condition against whatever is cached locally"

This makes perfect sence now.

I had a Filter() function else where in the app, Filter is delegable to SharePoint datasource, so that must have been updating the Datasource cache... then when UpdateIf() executed it was able to find those cached SP List items.

 

UpdateIf() was accidently working.

i'll make sure not to rely on this as a valid work-around.

 

thank you Carlos 🙂

 

Highlighted
Dual Super User II
Dual Super User II

Re: is UpdateIf delegable or not?

I wouldn't say that updateIf was accidentally working.  If you were using a delegable filter to get a subset of the records then Updateif was working as designed. If you tried to update the full data set , without the filter, then I suspect it would fail



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
Frequent Visitor

Re: is UpdateIf delegable or not?

Hi @Cam 

 

May I know how do you filter it?

Did you filter inside the UpdateIf function or do you filter from another screen or datatable?

 

When I use the Filter function inside the UpdateIf, the function won't work and receive the error message that the

filter function cannot be used in the formula. Below is the example. I want to update the records in Column3, Column4 and Column5 by having condition in Column1 and Column2. Also try the filter using the same condition.

 

UpdateIf(Filter(Testing, Column1 = DataCardValue1.Text, Column2 = DataCardValue2.Text), And(Column1 = DataCardValue1.Text, Column2 = DataCardValue2.Text), 
{Column3: DataCardValue3.SelectedDate, Column4: DataCardValue4.Text, Column5: DataCardValue5.Text})

 

 

Can you give me example of your solution?

Thanks in advance.

 

 

Highlighted
Advocate V
Advocate V

Re: is UpdateIf delegable or not?

hello HeihoSilver,

 

unfortunetly, after further testing.. i found the Filtering + UpdateIf method is too unreliable to recommend.

it sometimes works (~70% of the time), and sometimes doesnt (the other 30%)

 

i dont recommend trying to re-produce what i did with Filter() and UpdateIf()



"When I use the Filter function inside the UpdateIf"

i didnt put the function calls within each other, i put them once after another.

eg.
Filter( )

UpdateIf( )


Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,388)