KBA-01783: ATC Script Command Conditions

Question:

I notice that certain ATC commands (ATC: IFATC: ERRORIFATC: EXIT) accept “conditions”.  What are the possible conditions that can be used with these commands?

Answer:

Conditions

Several commands accept conditions. There are many different possible conditions that can be used with these script commands, but each command can use only one at a time.

  • CLOSED is true if and when the document is closed.
  • STAGE stagenumber is true if and when the route gets to the stage indicated by stagenumber. If no number is included, 2 is used by default.
  • NOSEQ n is true if and when there are no routees in Seq n. You can use * instead of a number to indicate “next Seq.”
  • HASSEQ n is true if and when there is a routee in Seq n. You can use * instead of a number to indicate “next Seq.”
  • HAS | HASNOT tablename WITH filter ;
    • HAS is true if there is a row in tablename that matches the filter. TargetRow can be used to reference that first matching row in a subsequent SET or IF.
    • HASNOT   is true if there is no row in tablename that matches the filter. If there are matching rows,
    • For both:
  • HASFAILED is true if the script has generated any uncaught errors.
  • DOCEXISTS [doctype] project docno supplemental; is true if and when the specified document exists.
    • [doctype] is optional. It specifies the source Doc type by name or internal key. Doc type names must be within square brackets and are case-sensitive, for example [Meeting Min]. If you don’t include a doctype, the Doc type of the current document is assumed.
    • project is required. It specifies the Project ID. You can use an * to specify the same project as the current document’s project.  Bookmarks and variables are acceptable.
    • docno is required. It specifies the source document number of the document that is to be checked. Bookmarks and variables are acceptable.
    • supplemental is optional and rarely used. It specifies either a batch number or the subcontract (commitment) ID. Bookmarks and variables are acceptable.
    • ; (semicolon) is required.
  • DocIsNew is true if the current document has never been saved
  • NODOC [doctype] project docno supplemental; is true if and when the specified document does NOT exist.
    • See the description of DocExists above for details!
    • semicolon is required
  • NOT [build 2019.0.7140 and later] at the beginning of any condition negates its test
  • PASTSEQ n is true if and when the document has been routed past the sequence indicated.  n can be an integer or a $Variable.
  • IsInternalUser is true if the user is an employee or has the Internal user role capability.
  • UserHas module capability is true if the current user has the indicated role capability.
    • module is required. Any role capability module can be specified
    • capability is required. Any role capability can be specified
      or
    • ROLE rolename – where any role name or key can be specified

Example

ATC: ATC IF CLOSED
     ATC: SET DocRevision.Notes=This doc is closed
ATC: ENDIF 
ATC: ATC IF NOT CLOSED 
     ATC: SET DocRevision.Notes=This doc is OPEN
ATC:ENDIF

The example illustrates the use of the NOT condition.  It can be combined with all other tests to reverse the test.

ATC: EXIT HAS DocAttachedFile WITH CatType = '5B0A71D8-ED55-455B-BB99-2AB7D3B7A1CF';

The example illustrates the use of the HAS condition to exit if the document already has a payment request (CatType) attached.


KBA-01783:Last updated: August 26, 2024 at 15:49 pm;  green text = new