Hi,
So I'm hoping someone can help me. I am trying to create a project number generator. So basically in SharePoint, a user would fill out the New form and it will generate a number for you based on the what the next highest number is. I have found a few tutorials and I can get it the number to increment based on the ID. However, this does not solve the problem where someone creates a number then deletes the row. This will lead to it skipping a number the next time an item is created.
Is there a way to calculate the highest number in a column and add 1? Can I loop through each row if needed to find the highest number?
Hi Scott,
Thanks for your help. I finally was able to achieve what I wanted used the Get items function you recommended. I sorted "Current_Numb desc" and set Top Count to 1. Then using the Update Item function, I set Current_Numb to
One way to approach this is to use a Get items action. Configure it to return just one item and sort in descending order on your column. That value will be the highest number now in that column.
In my example, I reference the ID, but you could reference any numeric column. You might want to create a variable and stuff the value in a variable.
Alternatively, you could maintain a second list with one entry that just stores the last number used. When you need a new number (next number), you can reference the list and then update it by incrementing the number by one.
If you have a high volume of transactions, norther of these are a great idea as it could generate duplicates. However, they will work if it you don't have a high volume of transactions.
WarrenBelz
146,605
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,946
Most Valuable Professional