Unique Record ID Generation - Timestamp Millisecond Limitations?

As I am adding suites of applications for new use cases, that may interact with tables created for our original application suite / use case, I am thinking I would like my record IDs to be a little more descriptive than what we started with.

Our original app created a Session ID via App Start trigger as follows:

We have a similar format for Table Record IDs generated via the app:

The Session ID is written into every table record created during the app session, and facilitates grouping records for subsequent analysis.
(I am also looking at how we can use this (maybe in another table column) to reflect the Session ID for the most recent record update, or even as an inelegant audit trail field wherein the Session ID for every subsequent edit is appended to a delimited string.)

I created the following to enhance the above by getting the text format in such a way that it is alphanumerically sortable and also indicates the app.

The expression is as follows:
datetimetotext(@App Info.Current Date and Time , ‘YYYY[m]MM[d]DD[t]HH:mm:ss.SSSZZ’) + ’ - ’ + @App Info.Logged-in User.Name + ’ - ’ + @App Info.App Name + ’ - ’ + @App Info.App Version

Based on the way we deploy apps, I’m thinking I can lose the App Version part.

However, when troubleshooting this ID formatting via button trigger, I noticed that even with the SSS milliseconds formatting enabled, no matter how many times I clicked the button as fast as I could, I could only see whole second intervals in the timestamp.

This is a concern to me for one of our new use cases wherein we care using Device triggers to capture torque analyzer output. It is possible that we could get two device outputs during the same 1000 milliseconds, which would prevent the second output from being recorded due to the Table Record ID being the same (I wouldn’t want to overwrite the first one either).

Is there a way to enable milliseconds time? We are running LTS 8.2, currently.

Hey James,

I know we talked about this in office hours a bit, but I wanted to document @william_vanbuskirk suggestion to try appending RANDOMSTRING() to guarantee unique record IDs. This past community discussion may also be helpful to reference Will RANDOMSTRING() ever repeat? - #2 by Pete_Hartnett

Let us know if you have success with this method!

Beth

Thanks again!

Related issue - seeking to be able to sort the record IDs alphanumerically such that they would also be in chronological order, when dealing with the time portion, what timezone is the @App Info.Current Date and Time using? Is it universal for all app users, or is it localized to the PC time on the machine running Tulip Player?

We have several sites using our apps across four US time zones, and I’d like records to sort in actual chronological order regardless of the time zone in which the user is located.

Also, confirmed it works:

Here button triggers create two records with the same ID format, but without the RANDOMSTRING(), which throws an error if they both fire in the same one second:

And here is the result when you have the RANDOMSTRING() appended to the record ID, despite both having the same timestamp in the ID:

It is interesting though that the Date Created timestamp differs by one second from the ID timestamp.