Hello everybody!
I want to get the highest/largest ID in a SharePoint library (the most recent item submitted) and return it to PowerApps (in order to use it as a "counter").
Is it possible? I am trying with formulas such as "Max" or "Sort" but every time this error appears:
It says that "Delegation problem” because it takes to many items.
I just want the last Item created ID and return it to Power Apps (so I don't need the formula to run through all the lines...).
Any solution will be usefull! Thanks!
Solved! Go to Solution.
The issue is that Sort in itself is delegable:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview
Sort Descending, turns the Table upside down such that the last item or ID becomes the first,
So you will not have issues picking the first from the sorted item which will be on top. That is it becomes number 1 no matter long the records.
------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
Sort and pick the first:
Last(Sort(Datasource,Descending)).CreatedID
------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
First(Sort(Datasource,ID,Descending)).ID
@eka24 I think you meant to use this formula
First(Sort(Datasource,ID,Descending)).ID
Thanks the answers!
It works but I still have the delegation problem, the same as before (with the yellow triangle), as you can see:
Any ideas?
(For information, 'Non-conformité App is my data source (SharePoint Library))
Change it from Last TO First
First(Sort('Non-conformité App,ID,Desending)).ID
The warning is because First() can't be delegated. But since you are sorting the list in Descending order, which can be delegated, you are assured that the highest Id is the First item in the list. So it won't matter that First() isn't delegable in this case. You only need the first item no matter how many there are.
Hi@Alexx1,
Based on the issue that you mentioned, do you want to remove the delegation warning?
Actually, the SharePoint ID field for a table is a number field in PowerApps. However, SharePoint only supports the equal "=" operator for delegation on an ID field.
Best Regards,
Qi
Thanks to everybody for the answers!
So I tested with "First" too and the warning still remains as you explained:
So are you telling me that it is normal, and that it doesn't matter if there is a warning? And that I will never have any problem with this, even if I have 10000 Items for example in the future?
Thanks! 😉
The issue is that Sort in itself is delegable:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview
Sort Descending, turns the Table upside down such that the last item or ID becomes the first,
So you will not have issues picking the first from the sorted item which will be on top. That is it becomes number 1 no matter long the records.
------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
The picture below has 7200 records in SQL:
------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
179 | |
47 | |
46 | |
34 | |
33 |
User | Count |
---|---|
258 | |
87 | |
78 | |
68 | |
67 |