ATC: IF condition | (table.field (operator value-expression | IsChanging))
If this command appears anywhere in the script, the entire script is run in the background (even if the command is in an ATC: IF command).
- condition is required if the field expression (described below) is not used and not allowed if the field expression is used. There are several possible conditions but you can only use one at a time.
- table.field (operator value-expression | IsChanging)
- table 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 table is specified. It separates table from field.
- field is required. It specifies the field to be evaluated.
- operator is optional but required with value-expression. Valid operators are = != > < IN or NOTIN LIKE or NOTLIKE.
- value-expression is optional but required with operator. The value can be any of the those listed in KBA-01932.
- IsChanging is optional. IsChanging is used in place of operator value-expression. It indicates that if the table.field has changed, the IF will be considered “true”.
- IsEmpty is optional. IsEmpty is used when you want to test if the value is DB NULL, a numeric zero or a string containing nothing except whitespace after HTML removal. A zero length string is obviously empty too!
Example
ATC: IF DUE < NOW() + 14
ATC: SET DocRevision.Notes=You have less than two weeks!
ATC: ELSE
ATC: SET DocRevision.Notes=You have more than two weeks.
ATC:ENDIF
The example above means “if the due date is less than today plus 14 days, set the Note field to the message You have less than two weeks! Otherwise, set the Note field to the message You have more than two weeks.
ATC: IF DocDate IsChanging
ATC: SET Title=Report for [DocHeader_DocDate]
ATC: ENDIF
The example above means “if the document date field changes, use the new document date in the document title, beginning with Report for; otherwise, do nothing.”
ATC: IF ProjectSubtype = CC
ATC: SET Location = Downtown
ATC: ENDIF
The example above means “if the Project Subtype is equal to CC, set the Location on the document to Downtown; otherwise, do nothing.”
ATC: IF subtype IN FP, GMP
ATC: SET Location = Contract Cap
ATC: ENDIF
The example above means “if the Subtype is equal to either FP or GMP, set the Location on the document to Contract Cap; otherwise, do nothing.”
ATC: IF DocItem.Specification LIKE 16*
ATC: SET Location = Sounds Electrical
ATC: ENDIF
The example above means “if the first document item has a specification that begins with 33, then set the Location on the document to Sounds Electrical; otherwise, do nothing.” See this handy reference about the LIKE operator.
ATC: IF UserHas WORK Staff
ATC: SET Location = The Staff Conference Room
ATC: ENDIF
The example above means “if the current user has WORK Staff in any role, then set the Location on the document to The Staff Conference Room; otherwise, do nothing.”
See also the examples in ATC: ELSE and ATC: ENDIF.
Last updated: June 3, 2026 at 14:24 pm; green text = new
