DELEGATION in Power Apps | Must Know to build efficient Apps

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone Resa here have you heard about delegation in power apps have you come across the data roll limit of 500 or 2,000 do you know how power apps handles large data let's Deep dive into delegation which is a key aspect that every App Maker must be aware [Music] of with canvas power apps we begin with the user experience in mind canvas apps allow us to build Pixel Perfect apps where we have full control over the app design however we are so focused on the design aspect of the power app that we as makers tend to ignore the concept of Delegation delegation is all about data data the key to building efficient apps is to minimize the amount of data that must be brought to the device that is running the power app and delegation is where power apps will delegate the processing of data to the data source let's take a scenario here I have a power app that is connected to a data source is a SharePoint list now this list has large data how large my list has more than 5,000 records in my app I have this Gallery whose items property is that connected data source here I am asking power apps to get all items from my SharePoint list of students you can think about this as a SQL query equivalent to select star from my students table this is a delegable query against my data source how do I know that the formula does not highlight any delegation warning so this should be listing all the data from my data source but if the query is delegable what power apps does automatically for us is it handles large data by loading data in batches as needed my gallery is actually showcasing the first 100 rows from my connected SharePoint list and to confirm that I will add a label control to show the gallery item count my gallery is called Gallery students dot all items count we can see that the count is 100 now as I scroll down once I hit the 100th item it will load the next 100 items batch loading the data in a performant way and this is how power apps handles large data if we go to Advanced tools we have the monitor tool where we can monitor activity in our power app if I scroll to the bottom of the gallery it should load the next 100 records and you can see that in monitor there's a network operation called get rows the request here is a get request to get data from the data source and it's getting data in an optimized manner working with large data sets requires using data sources and formulas that can be delegated now in power apps I can connect to my data sources data verse SharePoint SQL Excel and more but the question is do all data sources support delegation and the answer to that is in the document ation the top three delegable data sources in the order of the number of formulas that are delegable against that data source first Microsoft data verse followed by SQL followed by SharePoint for data verse here is the list of delegable formulas against the various data types here is the list for SQL and here is the list for SharePoint one of the power apps formulas search is not a delegable query against a SharePoint data source let's try it out search in my students list for the text James in the title column of my SharePoint list now observe the moment I write this formula you get this squiggly line if I hover over this it clearly states there is a delegation warning and the search part of this formula might not work correctly on large data sets this query is not delegable the underlying data source cannot perform the query so power apps has to perform the query and it has to load the data from the data source locally in the app power apps is not a data source so there has to be a limit as to how much data it will load in memory in order to perform the query and that is known as the data row limit if I head over to settings under General we have the data row limit for power apps by default this number is 500 it can be expanded to 2,000 at Max we cannot go one Beyond 2000 for this scenario I'll keep it to 500 and what this means is when there is a non-delegable query which this one is power apps will load the first 500 records in memory and then perform the query my list has over 5,000 rows my search query is searching for James in the title column power apps is returning one record but if I go to SharePoint and and filter and search for James you can see that I have various other records that include James this query will not give you accurate results with last data sets search is a delegable query if you select data verse as your data source it's more powerful now to identify delegation warnings the moment you write the formula you'll get the squiggly line but beyond beyond that as well if You observe on the screen I get this Hazard symbol once again highlighting that there is a delegation warning plus if you explore the app Checker here under the formulas I can clearly see the warning for delegation bear in mind delegation is a warning it is not an error you can publish an app with delegation warnings your end users can run those apps no warnings will be displayed for them they will simply be working with a limited data set if the queries are not delegable delegation is the responsibility of the App Maker we have a filter action and SharePoint called starts with where you can check to see if the data in the title column starts with the text James now this is delegable with respect to SharePoint as a data data source and now as you can see I am getting a total of nine records from my data source which is true I have over 5,000 rows and many of times we have to be creative when we write our formulas I would like to show all the students from my data source where the region is not South filter my students list where region which is a choice column so region. value is not equal to South not is not a delegable query with respect to SharePoint as a data source so as I mentioned sometimes we have to be creative I'll put an or action I want students who do not belong to region South I know my choice column has four options so I'll frame the query differently or is the delegable query equal is a delegable query get me all the students who belong to the region north or east or west meaning they do not belong to the region South now my query is delegable my gallery starts loading data in batches of 100 and as I keep scrolling down delegation magic comes into play optimize loading of data camouflaged delegation there are are scenarios where certain formulas do not throw a delegation warning which may lead you into believing that it is a delegable query one such example is the withd function let's try and frame this query with respect to the width function width I'll create a scoped variable called student data the query is my entire data source which is my students list and then as I'll write my filter formula to that scoped variable within width and execute my query notice no squiggly lines no delegation warning no Hazard symbol on the screen app Checker does not show it either but the reality is this is not a delegable query so how would I know if the query is delegable or not well one thing what we can do the delegation limit we can also go set it to one this is purely for testing purpose right now so I've changed this to one notice it only returns one result well because the query is not delegable what's my data rle limit one now another key aspect about delegation is working with collections so I've added a button and on select of this button I will go ahead and load data in a collection so I'll use the collect function I'll create a collection called collection of students and I will load the data from my students list collections variables be it Global context variables with which are scoped variables or the new named formulas all of this is maintained locally in the app when I click this button this will go and load the data from my students list in my collection you can see that it only loaded the first 500 rows now whenever I'm loading data I'm simply adding data to the same collection it will keep collecting data but a collection can keep storing data all of that data is held locally in memory in power app imagine a user running this on a mobile device device with limited storage limited bandwidth your app performance will take a hit now here I'll change my function to clear collect wherein I'm clearing the collection and then collecting the data again but this time I'll go and change my delegation limit from 500 to 5 now if I click load data notice the count changed to five that means collections variables named formulas they are all limited to that delegation limit make sure your queries are delegable check to see if you have delegation warnings go and modify those queries those formulas or choose better data sources that offer more flexibility in terms of Delegation depending upon your use case if you enjoyed this video then do like comment and subscribe to my YouTube channel and thank you so much for watching
Info
Channel: Reza Dorrani
Views: 29,097
Rating: undefined out of 5
Keywords: powerapps delegation, powerapps delegation warning, power apps, delegation in power apps, delegation, powerapps, delegable queries, non-delegable queries, data row limit, power apps performance, power apps tutorial, app building, large data sets, power apps functionality, powerapps 500 item limit, powerapps 500 item limit workaround, power apps delegation, powerapps delegation workaround, powerapps delegation warning filter, sharepoint delegation, how to, learn, reza dorrani
Id: 2cKcylsGlPg
Channel Id: undefined
Length: 13min 0sec (780 seconds)
Published: Mon Jan 29 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.