I am building an app to use for pollinator observations and a new record is created for either a new bee individual or the same bee individual but at a new flower. I created 2 variables in my Sharepoint table, one called FlowerNum and the other BeeNum. The idea is that someone can have an observation of a new individual (users press a button to increase BeeNum) and FlowerNum is set to begin at 1 and then have a second observation of the same individual but at a new flower (users would press a button to increase FlowerNum but BeeNum would stay the same).
I used "OnStart" to create a global variable: Set(varIncrementBee, 1).
I have a button for users to press called "New Bee" and the "OnSelect" properties of that are: Set(varIncrementBee, varIncrementBee+1).
I have these observations (including several others) patched to a Sharepoint table. Everything works great with one user. However, when 2 people use the app at the same time they can end up with the same BeeNum. I think the problem is varIncrementBee is always starting at 1. Is there a way to have a unique number for each observation?
When I patch each record I use "varNewItem" so I also tried setting the "OnStart" to: Set(varIncrementBee, varNewItem.ID) and the "New Bee" button "OnSelect" properties to Set(varIncrementBee, varNewItem.ID+1). This works somewhat but if you have several observations where you only clicked "New Flower" the next time you create an observation for "New Bee" the BeeNum has skipped several numbers (see attached photo). I'd like it to not miss out on numbers but if this is the best way to get a unique new bee number for each observation/user I will stick with it.
Any help is appreciated!