Evening all.
Quick question. I have a power app writing to a SP list.
The list has unique reference numbers manually entered 2001, 2002, 2003 etc.
What I want is a label (I will place in the edit screen) to lookup the last used reference number and add 1. Essentially providing the next reference number to enter.
So if the last number in the list is 2009.
The label would return 2010
Thanks in advance.
Solved! Go to Solution.
If you have more than 2000 items I would first sort the list in reverse order and pick the first item.
Value(First(Sort(YourList,Created,Descending)).ReferenceNumber)+1
While we are at it, why you don't just use the already existing ID field, which just does this for you automatically?
In the label try
First(Sort(Datasource,ID, Descending)).ID
This will give the last ID.
To Add
First(Sort(Datasource,ID, Descending)).ID+1
------------
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.
If you have more than 2000 items I would first sort the list in reverse order and pick the first item.
Value(First(Sort(YourList,Created,Descending)).ReferenceNumber)+1
While we are at it, why you don't just use the already existing ID field, which just does this for you automatically?
That worked perfectly thank you.
I eventually went with
If(IsBlank(DataCardValue10), Value(First(Sort('Drug and Alcohol Testing List',Created,Descending)).'Reference Number:')+1,"")
to only show the next number when the datacard was blank.
The ID field doesn't allow me to change the numbering system each year eg
2001 for Y2020
2101 for Y2021
2201 for Y2022
It also would leave a gap should an entry be deleted which doesn't look good in a list when presented as data IMO.
User | Count |
---|---|
211 | |
94 | |
84 | |
49 | |
38 |
User | Count |
---|---|
268 | |
104 | |
102 | |
59 | |
59 |