Hi Everyone,
I'm building a post-registration form and need to assign a custom, unique ID to each list item using YYYY.<number>.
Initially I built this logic using Flow but since our license results in a 5minute delay I need to figure out another way.
One way to assign a custom ID would be to create a random number on the form (text label) between 0-999999. I however need to check if this value does not already exist in the list and if it does, create a new number.
Is this possible without using Flow?
Thanks!
Your solution is the best ever. Thank you very much @CodrutFt All the best to you and family.
Thank you so much.
Hei, I am not sure if this will solve your problem because you said you might want to reset the numbers every year.
What I found also useful is in generating either a random number or a unique number is that you can work with the previously added item in that sharepoint list.
For example i had to create a 5 digits unique number for every line that will further go in a more complicated project number.
To get a number like that i used Text(Last('yourSPListName').ID)+10000.
I leave this here, because maybe it will be useful for other people.
Cheers.
You could have used the timestamp with Date, Text(Now(),"yyyymmddhhmmssfff")
Hi Everyone,
My users require(d) a list of unique numbers per year, not over just the complete set. Ideally even with numbering, starting every new year at 1.
Now I tried to fix that with a flow based on the 'item created', but the delay is too long.
Then I opted for the option to combine YYYY with SharePoint's ID in a calculated column, but it turned out that SharePoint calculates the column before giving it an ID, so that didn't work either.
Now I have just made it so that whenever the user opens the form in New mode, a direct Flow is triggered returning a unique ID based on YYYY & random number between 0 and 999999. That's probably the best solution I can come up with to work around the delay and (!) not calculating a number that can be calculated by two users who would work simultaneously.
Thanks for the input though!
hi there @Anonymous simply curious why do you need the unique id to be random? will the ID column in SharePoint not meet your need?
as you do not have a loop function in power apps you could use a timer control with the randbetween function to generate this.
for e.g. (data = {1,2,4,5,9})
Add timer
With the above the timer will be true when the value in data matches a generated number and it will stop when a random number is generated which is not in the data.
When the number is generated, the time is switched off at 6
Hope it helps,
R
Power Apps, as you've probably figured out, does not have a looping function with an exit condition, which is what you would use to compare generate IDs until a unique one comes up. A couple of ways around this:
Hope that helps,
Bryan
WarrenBelz
146,745
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional