mkuid
mkuid, special function
def special mkuid(a: _typ): number
def special mkuid(a: _typ, offset: number): number
Returns a unique number, with uniqueness maintained across Envision runs. This function is intended to uniquely identify results calculated by Lokad (for example, purchase order numbers that increment on each run).
The vector a is ignored, but the UID is generated as a scalar in the table of
a. The optional offset represents the starting suffix for the UID.
The generated numbers have the format PPPPPPPAAA, where:
Pis a page number (does not start with 0) that is always strictly increasing.Ais an incremented counter that starts atoffset(or 0 if omitted).Phas at least 7 digits.Ahas at least 3 digits.
Properties
- All UIDs can be parsed as numbers, and those numbers are different. UIDs have at least 10 digits, and can have more when more than 1000 are generated.
- A UID generated at time
Tis strictly inferior (lexicographic order) to a UID generated at timeT' > T. - If all calls generate a similar number of UIDs (less than 999, or between 1000 and 9999, etc.), then the previous property also holds for numeric order.
Example
table T = with
[| as Word |]
[| "The" |]
[| "quick" |]
[| "brown" |]
[| "fox" |]
[| "jumps" |]
show table "Unique identifiers" with
mkuid(T.Word, 123) as "Uid"
T.Word
This outputs the following table:
| Uid | Word |
|---|---|
| 1001000123 | The |
| 1001000124 | quick |
| 1001000125 | brown |
| 1001000126 | fox |
| 1001000127 | jumps |