Examples: Using conditional statements
- This agent example compares the number of elements in Categories to 0. If the field has elements, it is not changed (it is set to itself). If the field does not have elements, it is set to a constant string.
FIELD Categories := @If(@Elements(Categories) > 0; Categories; "To be supplied ..."); SELECT @All
- This window title example first checks the return value of @IsNewDoc. If the document is new, the window title is set to the text constant "New Topic." If the document already exists, the window title is set to the Subject field if the current view is AuthorView. Otherwise, the window title is set to the Subject field followed by a string denoting the number of response documents.
StandardTitle := Subject + @DocDescendants(" (No Responses)"; " (1 Response)"; " (% Responses)"); @If(@IsNewDoc; "New Topic"; @ViewTitle = "AuthorView"; Subject; StandardTitle)