@DocumentUniqueID (Formula Language)

The universal ID, which uniquely identifies a document across all replicas of a database. In text format, the universal ID is a 32-character combination of hexadecimal digits (0-9, A-F).

The universal ID is also known as the unique ID or UNID.

Syntax

@DocumentUniqueID

Usage

If two documents in replica databases share the same universal ID, the documents are replicas.

This function works in any formula that runs in the context of one or more documents.

To display the UNID, you must convert the result of this function to text, that is, you must specify @Text(@DocumentUniqueID).

The unique ID is one part of a document's entire ID number. To see a document ID, click the Document IDs tab of the document properties box. The UNID is on the first two lines following OF (first line) and ON (second line) in two 8-character segments.

Once created, a document's UNID never changes. If a document is copied and pasted, the pasted document gets a new UNID.

Every response document has a special field called $Ref that contains the UNID of the parent document.

In a field formula, @DocumentUniqueID (not converted to text) is a link to the document.

Examples

  1. This column formula displays the UNID of each document in the view.
    @Text(@DocumentUniqueID)
  2. This computed field formula creates a doclink to the current document.
    @DocumentUniqueID
  3. This "Computed when composed" field formula in a "Response" document creates a doclink to the parent document. In the properties box for the "Response" form, "Formulas inherit values from selected document" must be checked.
    @InheritedDocumentUniqueID
  4. You want the Project field of a new "Response" document to match the Project field of the parent "Main Topic" document. In the properties box for the "Response" form, check "Formulas inherit values from selected document." Make Project on the "Response" form a computed field and give it this formula:
    Project
  5. Field inheritance only happens once when the Response is created. However, you want to access the "Main Topic" after the "Response" is created. Create an agent that runs on a schedule, selects all documents in the database that use the form "Response," and runs the following formula:
    FIELD Project := @GetDocField($Ref; "Project");
    @All
  6. This is a long solution to the problem. Create a hidden view called, for example, "By doc ID" with the following selection formula:
    SELECT Form = "Main Topic"

    The first column is sorted and its formula is:

    @Text(@DocumentUniqueID)

    Create an agent that runs on a schedule, selects all documents in the database that use the form "Response," and runs the following formula:

    FIELD Project := @DbLookup("":""; ""; "By doc ID"; @Text($Ref); "Project");
    @All

    Each time the agent runs, it performs a lookup in the "By doc ID" view to find the "Main Topic" that is the parent of the current "Response" (that is, the document with a @DocumentUniqueID that matches the current document's $Ref field). It then copies the contents of the Project field from the parent to the child.