cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
robinthakur
Frequent Visitor

SQL Delegation Issue on AddTable

I'm using a Query using AddColumns to join two table together:

 

SortByColumns(Filter(AddColumns('[dbo].[DailyChecks_Mlog]', "Description Of Maintenance Job", dc_mlog_desc, "Maintenance Location", dc_mlog_loc, "Date Entered", Text(dc_timestamp ,"[$-en-GB]dd.mm.yyyy"),"Home", LookUp('[dbo].[DailyChecks_Master]',dc_record_id=dc_master_id).dc_home_id),Home=SelectedHome.Intranet),"dc_timestamp",Descending)

 

It's stopping returning rows at 500 like it's hitting a delegation problem. However I've checked the documentation for delegation on SQL, and the functions I'm using are all delegable (from what I can understand) as the Filter is comparing ints and Lookup is delegable. Even if I pare it back to:

 

AddColumns('[dbo].[DailyChecks_Mlog]', "Description Of Maintenance Job", dc_mlog_desc, "Maintenance Location", dc_mlog_loc, "Date Entered", Text(dc_timestamp ,"[$-en-GB]dd.mm.yyyy"),"Home", LookUp('[dbo].[DailyChecks_Master]',dc_record_id=dc_master_id).dc_home_id

 

It stops at 500 items. What is the likely issue here and how can I work around it without lifting the item limit to 2000 as I don't want to do that. 

 

Thank you in advance

R

2 ACCEPTED SOLUTIONS

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hi @robinthakur 

 

This is because AddColumns expression is not delegable. Can you try to update your expression to:

 

SortByColumns(AddColumns(Filter('[dbo].[DailyChecks_Mlog]' ,LookUp('[dbo].[DailyChecks_Master]',dc_record_id=dc_master_id).dc_home_id = SelectedHome.Intranet ),"Description Of Maintenance Job", dc_mlog_desc, "Maintenance Location", dc_mlog_loc, "Date Entered", Text(dc_timestamp ,"[$-en-GB]dd.mm.yyyy"),"Home", LookUp('[dbo].[DailyChecks_Master]',dc_record_id=dc_master_id).dc_home_id),"dc_timestamp",Descending)

 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

gabibalaban
Super User II
Super User II

Hi @robinthakur ,

Try to define a view on SQL database to extract and arrange the data and then filter this by Home=SelectedHome.Intranet and also sort it.

 

 

View solution in original post

5 REPLIES 5
yashag2255
Dual Super User II
Dual Super User II

Hi @robinthakur 

 

This is because AddColumns expression is not delegable. Can you try to update your expression to:

 

SortByColumns(AddColumns(Filter('[dbo].[DailyChecks_Mlog]' ,LookUp('[dbo].[DailyChecks_Master]',dc_record_id=dc_master_id).dc_home_id = SelectedHome.Intranet ),"Description Of Maintenance Job", dc_mlog_desc, "Maintenance Location", dc_mlog_loc, "Date Entered", Text(dc_timestamp ,"[$-en-GB]dd.mm.yyyy"),"Home", LookUp('[dbo].[DailyChecks_Master]',dc_record_id=dc_master_id).dc_home_id),"dc_timestamp",Descending)

 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

gabibalaban
Super User II
Super User II

Hi @robinthakur ,

Try to define a view on SQL database to extract and arrange the data and then filter this by Home=SelectedHome.Intranet and also sort it.

 

 

View solution in original post

Thank you both! I went the SQL route with views as that was actually very easy, but both approaches would work I believe. Crucially, it's easier to understand than the syntax of Addtables 🙂 I think it just threw me as there was no delegation warning, but I won't make that mistake again! Will replacing all direct read-only calls to tables with views speed up the app and is it in fact best practice? 

I did however notice one issue with this approach however. If I call the Refresh() command on the view after I've added an item, the view of items just disappears. and the gallery or table becomes empty. Is this a known issue with using views instead of direct SQL? 

Fixed the issue with the disappearing galleries. I was because my items query was driven using the view and a context variable which was getting reset. Storing this on a context variable and then using that worked. 

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

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (41,816)