Hi, for a transactional process that I am using I need to be able to create a robust and incrementing transaction ID. By robust I mean that it needs to continue increasing across different instances of the robot. I have thought about possibly saving the current number that it is on in a text file each time the workflow ends and reading that in and assigning it to the variable that continues increasing at the beginning of a new session, but maybe there is a better way? I also considered making a unique hash out of the current datetime or something but I’d like to avoid any overlapping IDs if possible.
Hi there @tjsauter,
You could utilise a GUID, for example: Guid.NewGuid().ToString
While each generated GUID is not guaranteed to be unique, the total number of unique keys (2^128 or 3.4×10^38) is so large that the probability of the same number being generated twice is very small. For example, consider the observable universe, which contains about 5×10^22 stars; every star could then have 6.8×10^15 universally unique GUIDs.
That’s a fantastic answer and I absolutely wish that I could use it in this case, will certainly keep it in mind in the future, but unfortunately I need numbers only (6 digits to play with) and it needs to be predictably incrementing so I can isolate failures by session and we can identify what was done per user.
You can store the Id in the Orchestrator Asset. Next time read it from asset and increment it. It will be more slick and asset available across all robots in the tenant.