Arbortext Command Language > Functions by Alphabetical Listing > generate_id
  
generate_id
generate_id (doc, oid, attrname[, text[, flags]])
The generate_id function generates an ID and optionally adds a suffix to the ID to make it more likely that the ID will be unique. The function will generate the ID through one of the following methods:
Call the generate_id callback, if it is available.
Generate an initial ID based on title, text, and element information from the document. If a unique ID is called for, append a string to the initial ID value. The string will be a hyphen ( - ) followed by eight hexadecimal characters representing the current time and date.
The generate_id function has the following arguments.
doc — (Optional.) The identifier of the document for which the ID is being generated. A value of 0 (zero, the default) refers to the current document.
oid — (Optional.) The object identifier of the element for which the ID is being generated. When an ID is being generated in a context that does not involve a particular element, the value of oid will be oid_null( ).
attrname — (Optional.) The name of the attribute for which the ID is being generated or a null string when the ID is not being generated for use as an attribute value.
text — (Optional.) An initial text string that can be used to help generate the ID. For example, this text could be used when the function is called without valid doc or oid arguments.
flags — (Optional.) A bitmask that determines whether the suffix is added to the ID.
0x000 — (The default value.) The generateuniqueidset option and Advanced Preference is used to determine if a unique suffix is added.
0x001 — Always add a unique ID suffix.
0x002 — Never add a unique ID suffix.
Other bits are unused and should not be set. If bits 0x001 and 0x002 are set, a value of 0x000 is assumed.