IQDoc
ITIQPro Docs Maintenance Connection Everywhere (MCe) · EAM/CMMS manuals
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.

Various people have said "Of course the default for ID should be" and then either {{name}} or {{ "now" | date: "%Y-%m-%d %H:%M" }} or {%newId%} or {%newShortGuid%}. At time of writing no one has picked any others as the 'of course it should be...' but some people prefer some of the other options for whatever reason. We don't see a need to force it, it is a one time setup.

Same as Name

Often 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.

But if you tend to not change the name, and you don't need the ID from another system, the one advantage of Name is that in many places in our system, if Name and ID are identical, it is only shown once. Consider:

This is the name [f52b026e-90bd-40ee-8318-51c5f2107261] compared with This is the name with no square brackets '[' ']', and no duplication.

To do this, set the ID default to {{Name}}. Note that it has to be Name not name .

Date-Time (now)

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" }}

If you or 2 people create one within a minute, you will get an error and have to change the value - usually just bumping the minute up or down by one

At time of writing, we support all of strftime: See https://strftime.net/ We have a document Formatting dates that lists the Date format strings including some other popular combinations.

GUID-UUID

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, 36 counting the dashes '-', 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%}

Human readable 4 words

A very good one to consider

Another one, that we restrict to 25 characters uses 4 random 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 preference:

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

More advanced:

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

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