Skip to content

AutoGenId

aggregating category: cdm-helpers no `||` resultSize: N

Generates a sequence of unique identifiers, optionally sized by another multi-sized field.

Creates an ID sequence. Without parameters, the sequence is unique to the field the rule is placed on. With a string parameter, the sequence is named and global — usable across tables and storable across runs via the StoreSequence table rule.

AutoGenId works with multi-sized results and can be forced to produce a fixed number of results by specifying a limit. To match an unlimited multi-sized field elsewhere, supply that field as the first parameter so AutoGenId produces the same number of results.

Parameters

1source Optional — accepts: field

A field whose multi-sized result size determines how many ids to generate. Required only when matching an unlimited multi-sized result.

2sequenceName Optional — accepts: STRING

The name of a global sequence. Named sequences are shared across tables and can be persisted between runs using StoreSequence.

Input type

Does not accept input.

Output type

  • INT[]

Requires

  • Allows multi-sized results.

Examples

Per-field local sequence

AutoGenId()

Per-field local sequence, exactly 2 ids

AutoGenId()[2]

Sized by another multi-sized field

AutoGenId(:another_field)[]

Named global sequence

AutoGenId("My Sequence")

Named global sequence, exactly 5 ids

AutoGenId("My Sequence")[5]

Named global sequence sized by another field

AutoGenId(:some_field, "My Sequence")[]

See also

GetCDMTableId, GetCDMFieldValue