cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HansHeintz
Helper V
Helper V

SQL First;sortbycolumns suddenly delegation error

Hi,

 
This code, using sql server suddenly comes back with a delegation error where it worked perfectly for months:
When I played as a kid it was considered unfair to change the rules while playing and I guess my users still feel the same way.
 

 

;;UpdateContext({FoundDier:First(SortByColumns(Filter('[dbo].[dier]';LastInputString in naam);"dier_id";Descending))})

 

12 REPLIES 12

Ignoring the warning might be fine but at the end of the day I don't want warnings to remain otherwise at some point I can no longer see the forest for the trees.

Hi @HansHeintz ,

According to your scenario, I think the Delegation limit would not affect your needs. The following formula could achieve your needs:

Set(MaxRecID; First(FirstN(Sort('[dbo].[dier]'; dier_id; Descending); 1)).dier_id)

 

In above formula, the Sort formula is delegable, so it could sort your SQL Table ('[dbo].[dier]') records based on the "dier_id" column properly in Descending order. The Sort formula could delegate the data process to your SQL Table properly without any Delegation issue. The max dier_id value would be at the first record in your Sort formula result.

 

The FirstN functionality is not a Delegable function, so it could only process first 2000 records locally at most. So the FirstN function could only process first 2000 records at most from the Sort formula result. The max dier_id value has been existed at the first record of the first 2000 records from the Sort formula result.

Note: Please make sure you have set the "Data row limit for Non-delegable queries" option to maximum value -- 2000 within Advanced settings of App settings of your app.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks, already posted this solution myself above so will mark that as the solition 😜

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (43,751)