Templates
Some worthwhile templates for IDs

Throughout the system, there are 'IDs' - typically unique values to be used to identify different things like Assets, Procedures, Reports, Zones.

Ofter you will look at those and say "Why can't the just be exactly the same as the names? Why is there something different?

The reason is there are times you might want to change the name, but not change all the historical records looking at it. In general, while names can freely change, IDs should not be changed once something has been used/referenced somewhere else. And yet, it is nice when trying to solve problems, when trying to write one-off reports, when looking at historical records to figure out how something got wrong, to have a value that can be humanly read easily - even if the exact value doesn't matter.

When creating ID values then, you can write 'rules' for how to determine the ID.

You could use a date stamp that shows the year, month, day, hour and minute if it is something that normally you wouldn't create more than one a minute. To get that, put in the preference:

{{ "now" | date: "%Y-%m-%d %H:%M" }}

At time of writing, we support all of strftime: See https://strftime.net/ We have a document 45baaf15-5f89-4680-80ab-6fb849c56eec that lists the Date format strings including some other popular combinations.

If you don't care about them being human readable and just want to make sure there is never a conflict, you could go with a Global Unique ID (GUID) aka in the Linux world, an UUID (Universal Unique ID), to get that put in the preference, this will create a 32 character GUID/UUID:

{%newGuid%}

or

{% newGuid %}

Or if it has to fit in a smaller ID because the 'other' system you are saving data to doesn't allow IDs 32 characters. If the system (many Accruent IDs must be no more than 25 characters for example) doesn't allow that many, there is a shorter 22 character version, it is just as secure, but it is encoded to take less space, be harder to read, but still easily cut and pasted. But it won't 'look' like a GUID/UUID.

  • How long is a short GUID???
{%newShortGuid%}

Another one, that we restrict to 25 characters uses 4 words separated by '.'s to make it easy to read and type, Examples of what it might create would be "Chicken.pot.pi.yum' or 'red.green.show.now', with these, if the created result is more than 25 characters, we create a different one. While it is virtually impossible for a GUID/UUID to conflict, these are pretty close - you are unlikely in the next 100 years to have a duplicate unless you are doing something that is creating millions of rows a minute. To get this type put in the preferenc:

{%newId%}
{{PK}}}
{{ID}}

What about taking an ID, stripping out whitespaces Or replacing them with - or _?

{{ ID | replace: " ", "-" }}
 
{{ ID | slice: 0, 25 }}