I'm trying to display the count of ID field in a label as text in an application. The application currently has more than 2000 records but now the count is struck at 2000 as i have set the delegation limit to 2000.
Is there a way i can modify countrows() function to overcome this delegation issue or can anyone suggest a better alternative so that count will be displayed even after 2000 is exceeded.
Any sort of help will be greatly appreciated.
I'm assuming that you are using SharePoint as a data source. If that is the case there really is no way to avoid the delegation issue and get a count of the number of rows in the entire data source. The only way to do it is to find a way to filter the data source into smaller chunks that are less than 2,000 items and page through each of those filtered lists and get a sum total from them.
For example, I have one demo where I filter a 5,000 record list by the first letter of the title and copy the records to a collection. I run that Collect() statement 26 times, once for each letter in the alphabet. When its done I have a collection with all the records in it. It works, but performance is slow for that many records and it really isn't worth it outside of a demo.
Hi @Anonymous ,
Based on the needs that you mentioned, I afraid that there is no way to achieve your needs in PowerApps currently.
The CountRows() function is a Non-Delegable function in PowerApps, which would be subject to 2000 Delegation limits. As an alternative solution, you could consider bulk-load your data source records into a collection in your app, then use the collection as data source in your app instead of original data source. Then you could apply the CountRows() function to the collection.
Please check and see if the following threads would help in your scenario:
Please consider take a try with above solution, check if the issue is solved.
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!