ATC: SET tablename.fieldname = value

This command sets a specified field on the current document to the value specified.

  • tablename is optional; however, if it is omitted, the Document Header (DocMasterDetail) is assumed. It specifies the target of the assignment. You can use @ to reference the current row in a FOREACH loop, or TargetRow to reference a recent row manipulated by another command such as ATC: ADD COMMENT or ATC: ADD ITEM.
  • . (period) is required only if tablename is specified. It separates tablename from the fieldname.
  • fieldname is required. It specifies the field in tablename to receive the value or—if tablename was omitted and fieldname begins with a $—the name of a local variable.
  • = (equal sign) is required.
  • value is required. The value can be any of the following:
    • new value specifies the value to be stored for the field.
    • @.fieldname a value from a field in the current row of the FOREACH loop
    • TargetRow.fieldname a value from a field in the current TargetRow
    • tablename.fieldname a value from a field in the source document
    • [bookmark] specifies a Word Template bookmark. The square brackets are required.
    • # (number sign) has special meaning when used with DocNo: indicates that the document number should be reassigned to the next available value during the next save.
    • * (asterisk) indicates that the value should be copied from the source document.
    • EMPTY sets the field to blank/empty.
    • NULL indicates a NULL value for the field.
    • LookupResult (dvname, value, dependson1, dependson2, dependson3) returns a value based on a scalar lookup (sort of like the Microsoft Excel VLookup function). See an example below.
      • dvname is the name of a lookup result. See the Lookup Result Validation Names section of  KBA-01535.
      • value is the value to look up, either a bookmark or a variable.
      • dependson1-3 are all optional and provide input values, either as bookmarks or variables
    • NOW () specifies that the current date and time should be used.
      • +n.n can follow NOW () to add a number of days (with decimal) to the current date.

Examples

ATC: SET SourceContact = *

The above example means “set the field SourceContact in DocMasterDetail equal to the value of the same field in the source document.”

ATC: SET ResponsibleParty = [DKEY_DocHeader_EditUser]

The above example means “set the field ResponsibleParty in DocMasterDetail equal to the value of the current user working with the document.”  Effectively, this makes the current user the Responsible Party.

ATC: SET DocNo = #

The above example means “reassign the doc number to the next available document number when the document is saved.”

ATC: SET DocRevision.Title = Notification

The above example means “set the value of the field Title in the table DocRevision equal to Notification. [See also the example for ATC: ENDLOOP.]

ATC: SET DocDate = NOW()+1

The example above means “set the document’s date to tomorrow.”

ATC: SET DocRevision.NoteA = EMPTY

The example above means “blank out the second notes field on the document’s Note tab.”

ATC: SET $Status = [DocHeader_Status]

The example above means “store the status in $Status.”

ATC: IF DocRevision.csString016 IsChanging
ATC: SET $SCDMK = LookupResult(SubcontractDocMaster, [DocRevision_csString016], [DocHeader_Project])
ATC: IF $SCDMK != EMPTY
ATC: SET SourceContact = LookupResult( DocSourceContact, $SCDMK)
ATC: ENDIF
ATC: ENDIF

The example above means “if the value in csString016 has changed, look up the Commitment document with the value in csString016 for the same project.  Take the key (for the Commitment) returned and look up the key of the vendor.”


Last updated: April 1, 2020 at 16:59 pm;  green text = new