Unix timestamp for unique record value

Using the Unix timestamp to generate a unique record value.

While Fulcrum generates a record id for every record in Fulcrum, this id is quite long and sometimes too long to use. What you can do is use the Unix Timestamp to generate a unique numeric record value that can be more manageable to use.

The ONCE() expression is used to ensure that the expression will only be run one time.

The expression below will generate unique value with 13 characters.

ONCE(Date.now);

The example below divides the unix timestamp by 1000 and drops the decimals places using the FLOOR() expression. This generates a unique value with 10 characters.

ONCE(FLOOR(Date.now()/1000));

The example below reduces the unique value to 8 characters.

ONCE(FLOOR((Date.now() - 1451606400000) / 1000));