@DocFields (Formula Language)

Returns a list of all the fields in a document.

Syntax

@DocFields

Return value

fields

Text list. Each item in the list is the name of a field on the document.

Usage

This function works in any formula that runs in the context of one or more documents. It does not work in column and view selection formulas.

After a document is saved, the returned list includes some of the internal Notes® fields, such as the Form field, that is added by Notes® to a form when it is saved or the $Links field, that indicates that the form contains a link to another document or database.

Examples

  1. This example returns Form; result; name; phone if those are the names of the fields in a document.
    @DocFields
  2. This example returns Yes if used in a field on a form that contains a rich text field containing a link to a database or document.
    @If(@Contains(@DocFields; "$Links"); "Yes"; "No")
  3. This example, when used in the postopen event of a form, enables the user to choose a field to alter from a list of the fields on the form then provide a value to put into the chosen field.
    Field fieldtochange := @Prompt([OkCancelEditCombo]; "Edit Fields"; "Please select the field you want to edit."; ""; @DocFields);
    @SetField(fieldtochange;(@Prompt([OkCancelEdit]; "New Value"; "Please enter a new value.";"") )
  4. This example, when used in a field on a form, returns the number of fields contained by that form when it is saved:
    @Elements(@DocFields)-2

    Subtract 2 from the total number of elements to account for the current field and the Form field, which is an internal Notes® field.