Professional Documents
Culture Documents
AgentryRuleEditorGuide 4 4 2
AgentryRuleEditorGuide 4 4 2
i
Chapter 1
Rules and the Rule Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
An Introduction to Rules in Agentry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Rule Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Rule Term Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Context and Return Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
The Rule Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
How Rules Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Overview of the Rule Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Adding and Editing Rule Terms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
How Rules are Used in Agentry. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Chapter 2
The Context of Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
What is Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Rule Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Context and Return Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Converting to Booleans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Converting to Strings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Conversion to Collections, Signatures, External Data, and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Conversion to Dates and Times. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Conversion to Numerical Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Context and Target Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Context and Rule Term Function Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Chapter 3
Rule Term Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Overview of Rule Term Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Strong and Loose Typed Function Arguments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
More on the Rule Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Rule Term Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Conversion Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
@DECIMAL_NUMBER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
@INTEGRAL_NUMBER. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
@SIG_DECIMAL_NUMBER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
@STRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Logical Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
@AND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
@CASE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
@CASE_INT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
@CASE_STRING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
@EQBOOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
@EQDEC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
@EQNUM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
@EQSTRING. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
@IF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
@NAND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
@NOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
@NOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
@OR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
@XOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Mathematical Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
@ABS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
@DIFF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
@DIV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
@FORMAT_DECIMAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
@GT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
@GTDEC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
@GTEQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
@GTEQDEC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
@LT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
@LTDEC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
@LTEQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
@LTEQDEC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
@MAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
@MIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
@MOD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
@PERCENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
@PRECISION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
@PROD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
@RANGE_LIMIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
@ROUND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
@SIGN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
@SIGNIFICANT_DIGITS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
@SQRT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
@SUM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
@TRUNC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Property Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
@COUNT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
@SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
@COLLECTION_MAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
@COLLECTION_MIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
@TOTAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
@MEMBER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
@PROP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
@TYPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
@CURRENTVALUE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
@SCREENFIELDVALUE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
@SCREENFIELDNAME. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
@UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
@LASTSCANVALUE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
@IS_SPECIAL_VALUE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
@IS_VALID_DECIMAL_NUMBER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
@NEEDS_XMIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
@TRANSACTIONPROPERTYNAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
@FILE_PATH_AND_NAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
@FILE_PATH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
@FILE_NAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
@FILE_EXTENSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
@FILE_SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
@FILE_CHANGED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
String Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
@CONCATENATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
@FIND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
@LEFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
@LENGTH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
@LOWERCASE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
@MID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
@NEWLINE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
@REMOVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
@REPLACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
@RFIND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
@RIGHT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
@TAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
@TRIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
@UPPERCASE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
System Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Time and Date Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
@DATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
@DATE_AND_TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
@TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
@MODULE_ENABLED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
@OFFLINE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
@USERID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Table Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
@COMPLEXTABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
@DT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
@ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
1
RULES AND THE RULE EDITOR
TOPICS:
• Introduction to Rules
• Overview of the Rule Editor
• How Rules are Used in Agentry
2 Chapter 1 - Rules and the Rule Editor
Rule Terms
A Rule Term is any one of several types of components to a rule, from something as simple as a
constant value, to one as complex as a sub-rule included within a Rule definition. Each Rule
Term returns a single piece of data to the term that called it, or to the Rule itself. The data type of
this data is entirely dependent on the Rule Terms Context (discussed shortly). The Rule Terms are
the components of a Rule that give it the desired behavior.
7 8 9
Chapter 1 - Rules and the Rule Editor 5
1. Name - The internal name of the Rule Definition. This value must be unique among all
Rule definitions within a given Module.
2. Group - This is the group within which the Rule is organized. This can be useful when
selecting Rules at a later time, as they will be organized into their assigned groups.
3. Description - A description of the Rule and its purpose. As with all definition types in
Agentry, the description is not required, but is recommended.
4. Rule Definition - This portion of the screen displays the actual Rule definition in a tree
control, with the Rule itself at the root node.
5. Reminder - Rules can have a reminder set that will result in a notice being displayed during
publish of the application.
6. Reset Button - Clicking the Reset button will reset the Rule Definition to its state when it
was first displayed in the Editor. For new Rules, this will remove all Rule Terms and Func-
tions from the definition. For existing Rules being edited, this will undo any changes made
to the Rule Definition, resulting in the Rule being as it was prior to the edit.
7. Clear Button - Clicking the Clear button will remove all Rule Terms from the Rule Defi-
nition, resulting in an empty rule.
8. Finish Button - This will save the Rule Definition, including all changes made to it.
9. Cancel Button - Clicking this button will exit the Rule Editor, discarding any changes
made to the Rule definition. If a new rule was being created, it will be discarded and no
Rule will exist within the Module.
to view and edit sub-rules. Following is an example of the Rule Editor with the popup menu
open.
In this example, the Conversion Function sub menu is selected, which lists all of the available
Rule Term Functions to be used for converting values from one data type to another.
In addition to the various functions, there is another group of items to select that consist mostly of
other definition types, as well as comments and constants. Selecting one of these items will result
in either the value of the definition or the definition itself being returned, depending on how the
term is used.
Chapter 1 - Rules and the Rule Editor 7
When adding or editing a Rule, it is important to understand how the rule is presented in the Rule
Editor. The following example contains a Rule definition, which is then described in more detail.
The overall purpose of this rule is to return to the cost of a number of items. This value is deter-
mined by multiplying the number of items selected in a screen field by the cost of each individual
item. The cost of an individual item is stored in a complex table, Items, which contains records of
each of the items that may be sold, along with various other information, including each item’s
unit cost.
Breaking this rule down, the root node in this tree structure is UpdateItemCost, which is the name
of the Rule definition. Directly below this is the function term PROD. Functions are denoted by
the @ symbol. This function takes two arguments, which are both numerical and will be multiple
by the function. The result of this multiplication will then be returned to the caller of the PROD
function, which, in this case, is the rule itself.
The two arguments to the PROD function in this example are the return value of another function,
COMPLEXTABLE, and the value of the field Qty in the current screen set. This is denoted in the
Rule Editor by the fact that both the COMPLEXTABLE term and the term “:>Current Screen
Set>Current Detail Screen> ‘Qty’ Field” are both child nodes of the node for the PROD.
The COMPLEXTABLE function also takes arguments, four in all. This function returns the value
of a field from a record in the specified complex table. The four arguments to the COM-
PLEXTABLE function are each child nodes of the COMPLEXTABLE node and tell the function
which complex table to read from, which record to look for based on a search value and index,
and the field from the record that is found to be returned.
Overall, it is not important right now to fully understand how each of these functions works. The
main point being described here is how a rule appears in the Rule Editor, specifically the structure
of a function and its arguments, with the arguments displayed as child nodes to the function. Each
of the functions themselves are described in detail later in this guide.
Enable Rules
Rules can be used to enable or disable different definitions within an application. These defini-
tions are those that allow the user to interact with that application. Some examples include Client
8 Chapter 1 - Rules and the Rule Editor
Actions, Screens within a Screen Set, and entire Modules. The return value of Enable Rules are
normally treated as Boolean, with true enabling the definition and false disabling it. For example,
an Action that allows the user to edit an object via a Transaction may be disabled if the selected
object is in a state in which it should not be edited by the user. In this case, the disabled, prevent-
ing the user from editing the object.
Update Rules
Update Rules are those used to update Fields on Detail Screens. These Rules can set the value of
a field based on data entered in another field on the same screen. Ultimately these values are then
set to the value of the property that field displays. Update Rules allow for a field’s display value
to be changed whenever another change occurs that should affect the fields value. For example,
the Rule shown previously, UpdateItemCost, is used as an Update Rule. When the user edits the
Qty (quantity) field on a Detail Screen, the rule is evaluated and the Total Cost field on the same
screen is updated. If the user changes the value of the Qty field, the Update Rule is evaluated
again, and the Total Cost field is updated accordingly. Update Rules allow you to display values
that may change based on changes to other values or conditions. The return type if update rules is
based on the edit type of the field definition.
Validation Rules
Validation Rules are used in Transaction and Fetch definitions. These Rules are used to determine
if a property value is valid or not. The fields in which users enter values contain attributes to
specify some limited validation-type of functionality, such as a range of numeric values, or the
length of a string. However, Validation Rules allow you to validate data entered by the user based
on variable conditions. For example, if a value entered by a user should be greater than one value
and smaller than another, each of which is also entered by the user, a Validation Rule is used.
Both Transactions and Fetches can contain one or more Validation Rules, each of which can vali-
date the value of a Property within the definition. If a Validation Rule fails, the user can then be
prompted to enter new values. Furthermore, this failure can be treated as a warning or error. The
first informs the user of the discrepancy, but does not require them to make any modifications.
The second will force the user to change the value in order to complete the transaction or fetch.
These types of rules return Boolean values, with true treated as valid, and false treated as failure.
Display Rules
Display Rules are those used to directly affect the appearance of the applications user interface.
There are numerous different attributes within the user interface components of an Agentry appli-
cation that can use rules. These include captions for Platforms and Screens, labels for columns,
buttons, and fields; values displayed in header and detail panes; images to be used in List Screen
Icons; and styles to be applied to any of the display components within a screen. These rules may
Chapter 1 - Rules and the Rule Editor 9
return string values for components such as labels or captions, or numeric values for items such as
List Screen Icons.
Include Rules
Include Rules are used in certain areas of an application when dealing with Object Collections.
These rules determine which of the objects within a collection are to be included in whatever pro-
cessing is taking place. The most common place for an Include Rule is within a List Screen,
where a rule can be used to determine which objects in a collection should be displayed in the List
Screen’s list control, and which should be excluded. Additionally, certain Rule Function Terms
can take, as one of their arguments, a sub-rule that is used as an include rule. The return type of
include rules is Boolean, where true will include the current object and false will exclude it.
Include rules are evaluated once for each object in the target collection, with the context of the
rule set by the object currently being evaluated by the rule.
Action Rules
Action Rules are those used within a Client Action that contains a SubAction step. This Action
Step can use a rule that returns one of multiple actions that is to be initiated by the SubAction.
This can allow an Action to perform variable sub-actions based on differing conditions.
Sub-Rules
Sub-Rules are those used within other rules. A sub-rule is a rule definition just like any other.
The only difference is that the value it returns is to another rule, rather than to another definition
type. Sub-rules can be defined to accomplish all of the same tasks as other rules and use any of
the functions available. Sub-rules can be useful when there is a particular task that needs to be
performed repeatedly by several other functions. If this task is involved, it may be useful to
define it once in a separate rule, and then use that rule as a sub-rule in other rule definitions where
it is needed.
10 Chapter 1 - Rules and the Rule Editor
2
THE CONTEXT OF RULES
TOPICS:
• What is Context
• Rule Data Types
• Context and Return Type
• Context and Target Paths
• Rule Term Functions and Context
12 Chapter 2 - The Context of Rules
What is Context
The concept of a rule’s context is one of the most important to understand when working with
Rules. This is because the context can have a significant affect on both the Rule itself, as well as
the functions that make up the Rule. A rule’s context is determined by how the rule is used, and
by what definition type. A rule that is used by a transaction as a validation rule will have a differ-
ent context then a rule used for an initial value of a property within the same transaction.
Additionally, the Rule’s context will affect its functions, as will the context of each function in
regards to what is calling the function. A function term called by another function expecting a
string value will have a different context then if it is called by a function that is expecting a deci-
mal number.
The context of a rule and its functions has the following affects:
• Return Type - Rule Term Functions do not have a set return data type. Rather, the value
returned by a function will always be of a type expected by that which is calling the func-
tion. This is also true of the rule definition itself. The value ultimately returned by the
rule will be converted to the type expected by the definition using the rule.
• Target Paths - Any target paths within a rule are affected by that rule’s context. If the
property of an object is included in a rule, how that property is found and its value re-
turned is affected by the context of the rule. If no such property is found, a null value will
be returned by the term containing the target path.
• Rule Term Function Behavior - Many rule term functions will behave differently based
on the context in which the function is called. A prime example of this is the @SUM
function. This function, when called in a numerical context, will treat its arguments as
numbers and add the values together, returning the sum. If, however, the function is
called in a string context, the arguments will be treated as strings and concatenated togeth-
er into a single string value that will be returned by the function. In the case of the @SUM
function, both the argument data types, as well as the function’s processing are affected by
the context in which the function is called.
To define the term more precisely, context is the way in which a Rule or Rule Term Function is
called and that affects the behavior, data types, and target path resolution when that rule is evalu-
ated.
This chapter will explain this concept in detail, including examples where different contexts result
in significant differences in the behavior of the same rule. Also, the various data types within
rules are discussed, as it is important to understand these types to fully understand the affects of
context on a rule.
Chapter 2 - The Context of Rules 13
Converting to Booleans
Whenever a value is converted from any other data type to a Boolean, the result will be a true or
false value. If the source type contains a null value, such as 0 for a numeric value, or an empty
string value, the result will be false. Any other value will be treated as true, including negative
numeric values, or whitespace string values.
Converting to Strings
By and large, converting from any other data type to a string is considered the safest conversion
that can be performed. In most cases, the value of the source type will be converted to a string
without the loss of any values due to truncation or other concerns with conversion. There are,
however, some exceptions to this. Following is a list of the handful of data types that should not
be converted to the string data type:
• Collection
16 Chapter 2 - The Context of Rules
• External Data
• Object
• Signature
Fortunately, there is not normally a need to convert such types to a string, as the results would be
meaningless. For example, what would the string value of an object collection be?
Other than these data types, conversion to a string will normally result in a safe conversion.
TOPICS:
• Overview of Rule Functions
• The Rule Editor: A Closer Look
• Rule Term Functions Described
22 Chapter 3 - Rule Term Functions
This menu contains several items. The first group allows you to cut, copy, and past rule terms, fol-
lowed by the group of items that allow you to work with sub-rules.
After this is a group of sub-menus, each of which contains several rule term functions. Each sub-
menu contains the functions for a group of functions available for use in a rule.
The next group contains the items for adding rule terms, such as values from Globals, comments,
or hard-coded values, as well as those values from other definitions, such as properties or actions.
Once an item is selected here, it will be placed in the rule as a child node to the one that you orig-
inally right-clicked on. If the term added is a function, you can then right-click that node to add
arguments to the function.
Chapter 3 - Rule Term Functions 25
Conversion Functions
The Conversion functions are those that allow you to set the context of a rule term so that the
value of that term is converted to the desired type. Following is a summary of the functions that
fall into this category.
• DECIMAL_NUMBER - This function converts the return value of the given term to a
decimal value. This function takes a single argument of any other non-decimal data type.
• INTEGRAL_NUMBER - This function converts the return value of the given term to an
integral value. It takes a single argument of any other non-integral data type.
• SIG_DECIMAL_NUMBER - This function converts the return value of the given term
to a decimal value, taking into account the rules of significant digits. It takes a single ar-
gument of any other non-decimal data type.
• STRING - This function converts the return value of the given term to a string value. It
takes a single argument of any other non-string data type.
Chapter 3 - Rule Term Functions 27
@DECIMAL_NUMBER
The DECIMAL_NUMBER function converts the value of its argument to a decimal number. The
argument may be of any other non-decimal data type. This value will then be returned by the
function to its caller. The value of the argument must contain only numeric characters for conver-
sion and will stop conversion on the first non-numeric character found.
Arguments:
• numericValue - This is the single argument taken by this function. It contains the value to
be converted by the function to a decimal value.
Evaluation Type: Decimal Number
Supported Return Types:
• Decimal Number
• Integral Number
• Property
• String
Examples:
@INTEGRAL_NUMBER
The INTEGRAL_NUMBER function converts the given argument to a integral value. The argu-
ment may be of any other non-integral data type. The argument value will be converted, starting
with the first numeric character, and will continue until the end of the value, or until a non-
numeric character is encountered.
Arguments:
• numericArg - The non-integral value to be converted to an integral by the function.
Evaluation Type: Integral Number
Supported Return Types:
• Decimal Number
• Integral Number
• Property
• String
Examples:
@STRING
The STRING function converts the value of the given argument to a string. The given value may
be of any non-string data type. The given value can contain any alphanumeric characters, plus
other printable symbols, as well as whitespace. Date and time values may also be converted to
strings, the format for which is dictated by the property containing the date and/or time value.
Arguments:
• characterArg - The value to be converted to a string value.
Evaluation Type: String
Supported Return Types:
• Decimal
• Integral
• Property
• String
Examples:
Logical Functions
Logical functions are those that provide the decision making functionality to the Rule definition.
This includes if-then-else logic, case statements, equality checks, and inclusive and exclusive
“and” and “or”, as well as others.
The evaluation type of most of the logical functions is Boolean. More often then not, these func-
tions take other functions as arguments. The logical functions allow you to make the necessary
decisions within a Rule to return differing values based on variable conditions.
Most of the rules defined for an Agentry application will contain one or more logical functions, as
these functions provide the decision making functionality that is usually the overall purpose of
using a rule. In the following descriptions, many of the examples used are more simplistic than
the real-world applications of these rules. The primary purpose is to show basic usage. It is
important to remember that the return value of a function may be used as a n argument to any
other function, and that this is how you will most likely implement your rules when developing
real-world applications.
32 Chapter 3 - Rule Term Functions
@AND
The AND function performs a logical conjunction between its arguments. Each of its argument is
evaluated in turn as a Boolean, beginning with the first argument. If any argument is evaluated as
false, the return value is false. Otherwise, the function returns true. The function must have at
least two arguments and may contain up to as many as is needed.
Arguments:
• boolArg1 - The first argument to be evaluated by the function for true or false. May be
any data type that can be treated as a Boolean value.
• boolArg2 - The second argument to be evaluated by the function for true or false. May be
any data type that can be treated as a Boolean value.
• boolArgN - The third through N optional arguments to the function to evaluated as true or
false. May be any data type that can be treated as a Boolean value.
Evaluation Type: Boolean
Supported Return Types:
• Boolean
• Decimal Number
• Integral Number
• String
Examples:
Given: InitialVal.propInitVal is 2
Boolean Return: TRUE
Decimal Number Return: 2.0
Integral Number Return: 2
34 Chapter 3 - Rule Term Functions
Given: InitalVal.propInitVal is 3
Boolean Return: TRUE
Decimal Number Return: 0.0
Integral Number Return: 0
Property Return: NULL property (There is no property at position “C”)
String Return: “C”
Given: InitialVal.propInitVal is 4
Boolean Return: FALSE
Decimal Number Return: 0.0
Integral Number Return: 0
Property Return: NULL property
String Return: empty string
Chapter 3 - Rule Term Functions 35
@CASE_INT
The CASE_INT function is used to return a single value from a variable list of multiple possible
returns. The first argument, intTestVal, to the function is converted to an integral value. The last
argument to the function is its default return value and is optional. The remaining arguments are
provided in pairs. The first argument in a pair is the value to which the intTestVal is compared. If
these two values are equal, the second value of the pair is returned by the function. The compari-
son between intTestVal and the first argument of each pair is performed as an integer comparison.
The value of the second argument in each pair may be of any data type and is converted to the
data type dictated by the context. If none of the comparison arguments match the intTestVal
argument, the value provided as the default argument is returned. If no default is provided, the
default value of the context’s data type is returned.
Arguments:
• intTestVal - An integral value tested against each of the comparison arguments in the ar-
gument pairs that follow. This argument must be an integral value and is a required argu-
ment.
• intComparisonArg1 - The first argument in a pair that is compared with the intTestVal ar-
gument. This value must be an integer and is required.
• valueArg1 - This argument contains the value returned by the function if
intComparisonArg1 is equal to intTestVal. This argument is required.
• intComparisonArg2-N - The first arguments in each pair of arguments that each contain
the value to be compared to intTestVal. These arguments are optional, but there are usual-
ly several pairs of comparison and value arguments in a single CASE_INT function call.
• valueArg2-N - The second arguments in each pair of arguments that each contain the val-
ue to be returned by the function if the corresponding comparison argument from the pair
is equal to intTestVal.
• defaultValArg - The defaultValArg argument is the final argument to the function and
contains the value to be returned by the function if none of the comparison arguments
match the intTestVal. This argument is optional.
Evaluation Type: Integral Number
Supported Return Types:
• Boolean
• Decimal Number
• Integral Number
• Property
• String
36 Chapter 3 - Rule Term Functions
Examples:
Examples:
@EQDEC
The EQDEC function takes two or more arguments, each evaluated as a decimal value, and com-
pares them for equality. If all argument values are equal, this function returns true. If any value
or values are found to be different, it returns false.
Arguments:
• decArg1 - This is the first argument, evaluated as a decimal number, to be compared to the
other arguments to the function. This argument is required.
• decArg2 - This is the second argument, evaluated as a decimal number, to be compared to
the other arguments to the function. This argument is required.
• decArg3-N - These are the 3rd through N arguments, each evaluated as a decimal number,
to be compared with the other arguments to the function. These arguments are optional.
Evaluation Type: Boolean
Supported Return Types:
• Boolean
Examples:
@EQSTRING
The EQSTRING function takes two or more arguments, each evaluated as a string, and compares
them for equality. If all argument values are equal, this function returns TRUE. If any value or
values are found to be different, it returns FALSE.
Arguments:
• strArg1 - This is the first argument, evaluated as a string, to be compared to the other argu-
ments to the function. This argument is required.
• strArg2 - This is the second argument, evaluated as a string, to be compared to the other
arguments to the function. This argument is required.
• strArg3-N - These are the 3rd through N arguments, each evaluated as a string, to be com-
pared with the other arguments to the function. These arguments are optional.
Evaluation Type: Boolean
Supported Return Types:
• Boolean
Examples:
@NAND
The behavior of the NAND function is dictated by its context. It takes a variable number of argu-
ments from 1 to N. In general, the purpose of this function is to negate the value of its argument
or arguments. It supports three of the return data types: Boolean; Decimal Number; and Integral
Number. If the context of the function call is Boolean, the function will evaluate all of the argu-
ments as Booleans. If all arguments evaluate to TRUE, the NAND function will return FALSE.
If one or more arguments are FALSE, it will return TRUE.
When the context is either a Decimal Number or Integral Number, the function takes only one
argument of the corresponding data type. The return value is the negative of the value given. So,
1.2 will return -1.2, -3 will return 3, etc.
Arguments:
• valueArg1 - This argument contains the value to be negated by the NAND function. This
argument is required in all contexts. For the Decimal and Integral Number types, this is
the only argument to the function, with any additional arguments being ignored. This ar-
gument is evaluated as the data type dictated by the function call’s context.
• boolArg2-N - These arguments are only evaluated by the function when it is called in a
Boolean context. Each of these optional arguments, along with valueArg1, are evaluated
as Booleans by the function. If any one of these values is FALSE, the function will return
TRUE. Otherwise it will return FALSE.
Evaluation Type: Context Dependent
Supported Return Types:
• Boolean
• Decimal Number
• Integral Number
Examples (Boolean Context):
@NOR
The behavior of the NOR function is dictated by its context. This function takes a variable num-
ber of arguments, the data types for which are also dictated by the function call’s context. The
function supports three of the return data types: Boolean; Decimal Number; and Integral Number.
If the context of the function call is Boolean, the NOR function will evaluate each argument as a
Boolean and return TRUE if all of its arguments are FALSE. If any one argument is TRUE, the
function will return FALSE. If the function is evaluated in a Decimal or Integral Number context,
each of its arguments are evaluated as a decimal or integral number type. The function subtracts
each of the argument values for arguments 2 through N from the value of argument 1 and returns
the result.
Arguments:
• valueArg1 - The first argument to be evaluated by the function. The data type of this argu-
ment is the same as the data type of the context in which the function is being evaluated.
• valueArg2-N - The optional arguments to the function, each of which is evaluated as the
same type as is dictated by the context of the function.
Evaluation Type: Context Dependent
Supported Return Types:
• Boolean
• Decimal Number
• Integral Number
Examples (Boolean Context):
@NOT
The behavior of the NOT function is dictated by its context. It takes a variable number of argu-
ments from 1 to N. In general, the purpose of this function is to negate the value of its argument
or arguments. It supports three of the return data types: Boolean; Decimal Number; and Integral
Number. If the context of the function call is Boolean, the function will evaluate all of the argu-
ments as Booleans. If all arguments evaluate to TRUE, the NOT function will return FALSE. If
one or more arguments are FALSE, it will return TRUE.
When the context is either a Decimal Number or Integral Number, the function takes only one
argument of the corresponding data type. The return value is the negative of the value given. So,
1.2 will return -1.2, -3 will return 3, etc.
Arguments:
• valueArg1 - This argument contains the value to be negated by the NOT function. This ar-
gument is required in all contexts. For the Decimal and Integral Number types, this is the
only argument to the function, with any additional arguments being ignored. This argu-
ment is evaluated as the data type dictated by the function call’s context.
• boolArg2-N - These arguments are only evaluated by the function when it is called in a
Boolean context. Each of these optional arguments, along with valueArg1, are evaluated
as Booleans by the function. If any one of these values is FALSE, the function will return
TRUE. Otherwise it will return FALSE.
Evaluation Type: Context Dependent
Supported Return Types:
• Boolean
• Decimal Number
• Integral Number
Examples (Boolean Context):
@OR
The OR function evaluates its arguments based on the context in which it is called. The data type
of the context dictates the data type of the function’s arguments and also the function’s evaluation
type. It supports the following return data types: Boolean, Decimal Number, Integral Number,
String. If called in a Boolean context, the function will return TRUE if any one or more of its
arguments evaluates to TRUE. If all function arguments FALSE, it will return FALSE. When the
context is one of the two numerical data types, it will sum the arguments according to that data
type and return the result. If the function is evaluated as a string, the function will concatenate the
arguments into a single string value for return.
Arguments:
• valueArg1 - This is the first argument to the function. It is evaluated as the same data type
as that of the function’s context. This argument is required.
• valueArg2 - This is the second argument to the function, which is evaluated as the same
data type as that of the function’s context. This argument is required.
• valueArg3-N - These optional arguments are evaluated according to the context of the
function. These arguments are optional.
Evaluation Type: Context Dependent
Supported Return Types:
• Boolean
• Decimal Number
• Integral Number
• String
Examples (Boolean Context):
@XOR
The XOR function provides the exclusive or logic to the Rule definition type. This function can
take two or more arguments, each of which is evaluated as a Boolean. The function returns TRUE
if one and only one of its arguments evaluates to TRUE, with all others evaluating to FALSE. If
all of the arguments evaluate to FALSE, or if two or more arguments evaluate to TRUE, this func-
tion will return FALSE.
Arguments:
• boolArg1 - This is the first argument to the function and is always evaluated as a Boolean.
This argument is required.
• boolArg2 - This is the second argument to the function and is always evaluated as a Bool-
ean. This argument is required.
• boolArg3-N - These arguments are always evaluated as a Boolean and or optional.
Evaluation Type: Boolean
Supported Return Types:
• Boolean
Examples:
Mathematical Functions
The mathematical category of functions within the Rule definition type are those that provide the
ability to perform mathematical and comparisons operations on numeric values. This includes
functions for the basic mathematical operations of addition, subtraction, multiplication, and divi-
sion. It also includes other math operations, such as modulus, percents, absolute values, working
with precision and significant digits, making greater than and less than comparisons, and other
numeric-based operations.
Most of these functions work exclusively with integral and/or decimal values. There are a small
number of exceptions to this, such as the SUM unction, which can be used to concatenate strings.
By and large, however, the mathematical functions operate on and return numeric values.
There are many functions intended to use specifically decimal values and others specific to inte-
gral values. When using these functions, arguments will be evaluated as one of these two data
types. This is important to note as, if evaluating a decimal as an integral, data loss can occur, as
the fractional portion of a decimal value is truncated when it is evaluated as an integral.
56 Chapter 3 - Rule Term Functions
@ABS
The ABS function returns the absolute value of the argument given. The function takes a single
argument, which is evaluated as either an integral or decimal value, depending on the context of
the function. Likewise, the evaluation type of the function is also dependent on this context.
Arguments:
• numericArg - This argument contains the numeric value whose absolute value will be re-
turned. The data type of this argument is either decimal or integral, dependent on the
functions context.
Evaluation Type: Context Dependent
Supported Return Types:
• Decimal Number
• Integral Number
Examples:
@FORMAT_DECIMAL
The FORMAT_DECIMAL function converts the given numeric value into a string. It takes six
arguments, many of which are optional, that are used to create the final string value. The first
argument, decNumArg, is the value to be converted and is required. This argument is evaluated
as a decimal, though integral numbers may be passed in.
Arguments:
• decNumArg - The decimal number to be formatted as a string. This argument is required.
• intPrecision - This argument specifies the precision to which the value of decNumArg
should be converted, that is, the number of places beyond the decimal that should be a part
of the resulting string value. The last digit kept is rounded based on the following digit.
To return an integral value, this should be 0. This argument is optional and, if not present,
the precision is automatically calculated.
• boolUseThousandsChar - This argument is evaluated as a Boolean and specifies whether
or not the resulting value should contain a character at each third number, e.g. 1000000
(FALSE) vs. 1,000,000 (TRUE). This argument is optional and the default value is
FALSE. The default character to use is a comma, though this may be overridden using the
strThousandsChar argument.
• boolUseLeadZero - This argument is evaluated as a Boolean and specifies whether or not
to use a leading zero if decNumArg is a fractional value (e.g. 0.23 vs. .23). This is an op-
tional argument and is TRUE by default.
• strDecChar - This argument is evaluated as a string, though only the first character of the
string is respected, with any extras being ignored. This argument specifies the character to
use to denote the beginning of the fractional portion of the value. This argument is option-
al and the default is to use a decimal (.) character. (NOTE: Many non-English languages
denote the decimal portion of a number using a comma (,) rather than a decimal.)
• strThousandsChar - This argument is evaluated as a string, though only the first character
of the string is respected, with any extra characters being ignored. This argument speci-
fies the character to use if boolUseThousandsChar is true. This argument is optional and
the default value is a comma (,) character. (NOTE: Many non-English languages denote
the thousands place using a decimal (.) rather than a comma.)
Evaluation Type: String
Supported Return Types:
• String
Examples:
@GT
The GT function takes at least two arguments, with as many more as needed, each of which are
evaluated as Integral Numbers. The first argument is compared to each additional argument in
turn. If the first argument is found to be greater than all other arguments, the function returns
TRUE. Otherwise, it will return FALSE. Note that this function compares only integral number
values. See the description for GTDEC for comparing decimal numbers.
Arguments:
• intTestNum - This argument contains the value to be tested against the values of all other
arguments to the function. This argument is evaluated as an integral number and is a re-
quired argument.
• intCompareNum1 - The first argument to be compared against intTestNum. This argu-
ment is evaluated as an integral number and is a required argument.
• intCompareNum2-N - The 2nd through N arguments compared against intTestNum. Each
of these arguments are evaluated as an integral number and are optional.
Evaluation Type: Boolean
Supported Return Types:
• Boolean
Examples:
@GTEQ
The GTEQ function takes at least two arguments, with as many more as needed, each of which are
evaluated as Integral Numbers. The first argument is compared to each additional argument in
turn. If the first argument is found to be greater than or equal to all other arguments, the function
returns TRUE. Otherwise, it will return FALSE. Note that this function compares only integral
number values. See the description for GTEQDEC for comparing decimal numbers.
Arguments:
• intTestNum - This argument contains the value to be tested against the values of all other
arguments to the function. This argument is evaluated as an integral number and is a re-
quired argument.
• intCompareNum1 - The first argument to be compared against intTestNum. This argu-
ment is evaluated as an integral number and is a required argument.
• intCompareNum2-N - The 2nd through N arguments compared against intTestNum. Each
of these arguments are evaluated as integral numbers and are optional.
Evaluation Type: Boolean
Supported Return Types:
• Boolean
Examples:
@LT
The LT function takes at least two arguments, with as many more as needed, each of which are
evaluated as Integral Numbers. The first argument is compared to each additional argument in
turn. If the first argument is found to be less than all other arguments, the function returns TRUE.
Otherwise, it will return FALSE. Note that this function compares only integral number values.
See the description for LTDEC for comparing decimal numbers.
Arguments:
• intTestNum - This argument contains the value to be tested against the values of all other
arguments to the function. This argument is evaluated as an integral number and is a re-
quired argument.
• intCompareNum1 - The first argument to be compared against intTestNum. This argu-
ment is evaluated as an integral number and is a required argument.
• intCompareNum2-N - The 2nd through N arguments compared against intTestNum. Each
of these arguments are evaluated as an integral number and are optional.
Evaluation Type: Boolean
Supported Return Types:
• Boolean
Examples:
@LTEQ
The LTEQ function takes at least two arguments, with as many more as needed, each of which are
evaluated as Integral Numbers. The first argument is compared to each additional argument in
turn. If the first argument is found to be less than or equal to all other arguments, the function
returns TRUE. Otherwise, it will return FALSE. Note that this function compares only integral
number values. See the description for LTEQDEC for comparing decimal numbers.
Arguments:
• intTestNum - This argument contains the value to be tested against the values of all other
arguments to the function. This argument is evaluated as an integral number and is a re-
quired argument.
• intCompareNum1 - The first argument to be compared against intTestNum. This argu-
ment is evaluated as an integral number and is a required argument.
• intCompareNum2-N - The 2nd through N arguments compared against intTestNum. Each
of these arguments are evaluated as an integral number and are optional.
Evaluation Type: Boolean
Supported Return Types:
• Boolean
Examples:
@MAX
The MAX function takes two or more arguments containing numerical values and compares each
to the other. It hen returns the largest value found among all its arguments. The arguments are
evaluated as either Decimal or Integral Numbers, depending on the context of the function itself.
Arguments:
• numArg1 and 2 - This first two values to be compared against the others by the function.
This value is evaluated as either a Decimal or Integral number, depending on context.
• numArgN - The last argument to the function, which can take a variable number of argu-
ments. This argument is optional, as are all arguments after the first two. These argu-
ments are evaluated as either Decimal or Integral Numbers, depending on context.
Evaluation Type: Context Dependent.
Supported Return Types:
• Decimal Number
• Integral Number
Examples:
@MOD
The MOD function performs a modulus operation on its two arguments and returns the result.
The first argument (dividend) is divided by the second argument (divisor) and any remainder is
returned. The arguments are evaluated as either Decimal or Integral Numbers, depending on the
context of the function.
Arguments:
• dividendArg - This argument is the value to be divided by the divisorArg argument. This
value is evaluated as either a Decimal or Integral Number, depending on the context of the
function. This argument is required.
• divisorArg - This argument is divided into the dividendArg argument. This value is eval-
uated as either a Decimal or Integral Number, depending on the context of the function.
This argument is required.
Evaluation Type: Context Dependent
Supported Return Types:
• Decimal Number
• Integral Number
Examples:
@PRECISION
The PRECISION function takes a single argument, evaluated as a Decimal Number. It then
returns the number of digits after the decimal point in the value.
Arguments:
• decDecimalNum - This argument contains the value whose precision is to be determined.
This argument is evaluated as a Decimal Number and is required.
Evaluation Type: Decimal Number
Supported Return Types:
• Decimal Number
• Integral Number
• String
Examples:
@RANGE_LIMIT
The RANGE_LIMIT function constrains a given value to within a range of values. The function
takes three arguments: a lower limit; the value to be constrained; and an upper limit. If the value
to be constrained is greater than the lower limit and less than the upper limit, the function will
return the value. If this value is less than the lower limit, the value of the lower limit will be
returned. If the constrained value is greater then the upper limit, the upper limit value will be
returned. Each of the three arguments are evaluated as either Decimal or Integral Numbers,
depending on the context of the function.
Arguments:
• numLowerLimit - This argument specifies the lower limit of the range of values to which
the numConstrainedVal should be limited. This argument is evaluated as either a Decimal
or Integral Number, depending on the function’s context.
• numConstrainedVal - This argument contains the value to be constrained. The value is
evaluated as either a Decimal or Integral Number, depending on the function’s context.
• numUpperLimit - This argument specifies the upper limit of the range of values to which
the numConstrainedVal should be limited. This argument is evaluated as either a Decimal
or Integral Number, depending on the function’s context.
Evaluation Type: Context Dependent
Supported Return Types:
• Decimal Number
• Integral Number
Examples:
@SIGN
The SIGN function takes a single argument and returns a value indicating whether the argument
value is negative, zero, or positive. The argument is evaluated as a Decimal Number.
Arguments:
• decTestNum - This argument contains the value to be checked by the function for a posi-
tive, negative, or 0 value. It is evaluated as a Decimal Number.
Evaluation Type: Decimal Number
Supported Return Types:
• Decimal Number
• Integral Number
Examples:
@SQRT
The SQRT function returns the square root of a decimal number out to the specified number of
digits after the decimal. The number for which the square root is found is evaluated as a decimal
number. The precision of the result is specified by an integral number.
Arguments:
• decNumArg - This argument contains the value whose square root is to be determined.
This argument is evaluated as a Decimal Number and is required.
• intPrecision - This argument contains the number of digits after the decimal place to
which the square root value should be calculated.
Evaluation Type: Decimal Number
Supported Return Types:
• Decimal Number
Examples:
Property Functions
The Property Functions within the Rule definition provide you with the ability to access and
manipulate various pieces of information within properties. These functions are further organized
into those functions for different property types. For example, there are several functions are spe-
cifically intended to be used with External Data Properties, and others for working specifically
with collections.
Some of the functionality provided by these functions include the ability to determine if a proper-
ties value is equal to the defined special value of that property; access to information about a file
referenced by an external data property; or to determine the number of members in a collection
property.
In the descriptions that follow, the functions are presented in the order in which they are displayed
in the Property Function sub-menu of the Rule Editor. These functions are organized according to
the general type of functionality, or the property type to which they provide access.
Chapter 3 - Rule Term Functions 85
@COUNT
The COUNT function takes two arguments. The first is required and is evaluated as a collection
property. The function returns the number of members in this collection. The second argument is
optional and is evaluated as an Include Rule. This rule is evaluated once for each member of the
collection and returns TRUE or FALSE. It is used to include only certain members of the collec-
tion. If an Include Rule is provided, the function will only count those members of the collection
that result in a TRUE return from the include rule. Those that result in a FALSE return will not be
counted.
Arguments:
• collCollectionProp - This argument is evaluated as a collection property. The function
counts the members of this collection and returns the result. This argument is required.
• ruleIncludeRule - This argument is evaluated as an Include Rule. If this argument is pres-
ent, the rule will be evaluated once for each member of the collection, with its context dic-
tated by the member. For each member that results in a return value of TRUE, the
function will count that member. It will not count those for which a FALSE value is re-
turned.
Evaluation Type: Integral Number
Supported Return Types:
• Boolean
• Integral Number
• String
Examples: In the following examples, the collection Customers contains 10 total members.
Three of these members have a status of Inactive, with the rest having a status of Active.
@SIZE
The SIZE function takes two arguments. The first is required and is evaluated as a collection
property. The function returns the number of members in this collection. The second argument is
optional and is evaluated as an Include Rule. This rule is evaluated once for each member of the
collection and returns TRUE or FALSE. It is used to include only certain members of the collec-
tion. If an Include Rule is provided, the function will only count those members of the collection
that result in a TRUE return from the include rule. Those that result in a FALSE return will not be
counted.
Arguments:
• collCollectionProp - This argument is evaluated as a collection property. The function
counts the members of this collection and returns the result. This argument is required.
• ruleIncludeRule - This argument is evaluated as an Include Rule. If this argument is pres-
ent, the rule will be evaluated once for each member of the collection, with its context dic-
tated by the member. For each member that results in a return value of TRUE, the
function will count that member. It will not count those for which a FALSE value is re-
turned.
Evaluation Type: Integral Number
Supported Return Types:
• Boolean
• Integral Number
• String
Examples: In the following examples, the collection Customers contains 10 total members.
Three of these members have a status of Inactive, with the rest having a status of Active.
@PROP
The PROP function takes a variable number of arguments. Each argument is evaluated as a prop-
erty and this evaluation is within the context dictated by the argument that precedes it in the argu-
ments to the function. The overall purpose of this function is to provide a kind of drill-down
access to the value of a property that may be a descendent of the current object. For example,
assume there is a Customer object. This object contains a collection property of Order objects.
Each Order object, in turn, contains a collection of OrderItem objects, which represent individual
items ordered by a customer. If the context of the function call, or the Rule in which it is con-
tained, is a Customer object, and you wish to retrieve the value of a property in an OrderItem
object, this function can be useful. Each argument to the function is evaluated in the context of
the argument that is before it. So, in this example, to retrieve the desired OrderItem object, the
first argument would be the desired Order for the customer, and the second would be the Order-
Item object. Normally, each of these arguments is actually another function call that locates the
desired property via some sort of search.
Arguments:
• propChildProperty - This is the first argument to the function, evaluated as a property, and
in the context of the function call. It is normally an object property, or a member of a col-
lection property of the current object. This is a required argument.
• propDescendentProp1-N - These are the descendent arguments
Evaluation Type:
Supported Return Types:
•
Examples:
Chapter 3 - Rule Term Functions 95
@TYPE
The TYPE function takes a variable number of arguments. Each argument is evaluated as a prop-
erty and this evaluation is within the context dictated by the argument that precedes it in the argu-
ments to the function. The overall purpose of this function is to provide a kind of drill-down
access to a property that may is a descendent of the current object. For example, assume there is a
Customer object. This object contains a collection property of Order objects. Each Order object,
in turn, contains a collection of OrderItem objects, which represent individual items ordered by a
customer. If the context of the function call, or the Rule in which it is contained, is a Customer
object, and you wish to retrieve the value of a property in an OrderItem object, this function can
be useful. Each argument to the function is evaluated in the context of the argument that is before
it. So, in this example, to retrieve the desired OrderItem object, the first argument would be the
desired Order for the customer, and the second would be the OrderItem object. Normally, each of
these arguments is actually another function call that locates the desired property via some sort of
search. The function then returns the type of the property found. Note that this is not the data
type of the property, but rather the definition name, such as “Customer.” In a Boolean context, the
function returns TRUE if the property is found; in a integral number context, the internal ID of the
definition is returned.
Arguments:
• propChildProperty - This is the first argument to the function, evaluated as a property, and
in the context of the function call. It is normally an object property, or a member of a col-
lection property of the current object. This is a required argument.
• propDescendentProp1-N - These are the descendent arguments
Evaluation Type: Property
Supported Return Types:
• Boolean
• Integral Number
• String
Examples:
@CURRENTVALUE
The CURRENTVALUE function takes a variable number of arguments. Each argument is evalu-
ated as a property and this evaluation is within the context dictated by the argument that precedes
it in the arguments to the function. The overall purpose of this function is to provide access the
value of a property in a drill-down fashion. It also works with the user interface on the Client in
that, if a file on the current screen is found to be mapped to the last property argument to the func-
tion, the value of the field is returned, not that of the property. This function may also take a sin-
gle argument, in which case that property’s value, or the value of a field that is mapped to the
property, is returned.
Arguments:
• propChildProperty - This is the first argument to the function, evaluated as a property, and
in the context of the function call. It is normally an object property, or a member of a col-
lection property of the current object. This is a required argument.
• propDescendentProp1-N - These are the descendent arguments, each of which is evaluat-
ed in the context of the argument that precedes it.
Evaluation Type: Property
Supported Return Types:
• Boolean
• Decimal Number
• Integral Number
• Property
• String
Examples:
Boolean: TRUE
Decimal Number: 11291.0
Integral Number: 11291
Property: The acctnum property of the Customer object.
String: “11291”
Chapter 3 - Rule Term Functions 97
@SCREENFIELDVALUE
The SCREENFIELDVALUE function takes a variable number of arguments. Each argument is
evaluated as a property and this evaluation is within the context dictated by the argument that pre-
cedes it in the arguments to the function. The overall purpose of this function is to provide access
the value of the field that is mapped to the final property evaluated by the function, that is, the last
argument of the function. It will also retrieve the value of a field if the function is given a single
argument, and that argument is the name of a field.
Arguments:
• propChildProperty - This is the first argument to the function, evaluated as a property, and
in the context of the function call. It is normally an object property, or a member of a col-
lection property of the current object. This is a required argument.
• propDescendentProp1-N - These are the descendent arguments, each of which is evaluat-
ed in the context of the argument that precedes it.
• stringFieldName - This argument is evaluated as a string and will return the value of the
field contained in the argument. If this form of the function is used, this argument is re-
quired and is the only argument that should be passed to the function. The field referenced
must be defined on the current screen being displayed.
Evaluation Type: Property
Supported Return Types:
• Boolean
• Decimal Number
• Integral Number
• Property
• String
Examples:
Given: Qty is a decimal number field on the current screen and has a current value of 4.6
Boolean Return: TRUE
Decimal Return: 4.6
Integral Return: 4
Property Return: The Property mapped to the field.
String Return: “4.6”
98 Chapter 3 - Rule Term Functions
@SCREENFIELDNAME
The SCREENFIELDNAME function takes no arguments. It will return the name of the Detail
Screen Field that is currently in context.
Arguments: N/A
Evaluation Type: String
Supported Return Types:
• String
Examples: The following Rule is used as an Update Rule for a field named Cost.
@LASTSCANVALUE
LASTSCANVALUE returns the last value scanned in by the client device while the Agentry Cli-
ent was running. If called prior to a value being scanned in, it will return null. The last scanned
value will be returned regardless of where the rule term function is called, or how long after the
value was scanned. Exiting and restarting the Client will remove the scanned value and the func-
tion will return null until a new value is scanned.
Arguments:
• N/A
Evaluation Type: String
Supported Return Types:
• String
Examples:
@IS_VALID_DECIMAL_NUMBER
The IS_VALID_DECIMAL_NUMBER function is used to check whether or not a Decimal
Number property contains a valid decimal number, or the value NaN (Not a Number). The value
NaN is also returned when any value is divided by 0. If the value is a valid decimal number, this
function returns TRUE. Otherwise it will return FALSE.
Arguments:
• decDecimalVal - This argument is evaluated as a Decimal Number. Its value is checked
for validity by the function.
Evaluation Type: Boolean
Supported Return Types:
• Boolean
Examples:
Boolean Return: TRUE if Current Object has a pending transaction, otherwise FALSE.
104 Chapter 3 - Rule Term Functions
@TRANSACTIONPROPERTYNAME
This rule term function returns the name of the property being set by the rule from within which
the function is called. This function is only supported in rule definitions evaluated as initial value
rules for transaction properties. Its return value is undefined in all other contexts.
Arguments:
• N/A
Evaluation Type: String
Supported Return Types:
• String
Chapter 3 - Rule Term Functions 105
@FILE_PATH_AND_NAME
The FILE_PATH_AND_NAME function is provided to work with the external data type property.
This function takes a single argument, evaluated as an external data property, and returns the full
path and file name, as a string, of the file referenced by that property. If the property does not ref-
erence a file, this function returns an empty string. Note that file paths on Windows CE devices
do not contain a drive letter, but rather begin with a single back slash (\).
Arguments:
• edpExternalDataProperty - This argument is evaluated as an external data property by the
function. It is a required argument.
Evaluation Type: String
Supported Return Types:
• String
Examples: In the following examples, SchematicProp references files located at the location
\MyDocs\Schematics and are all .jpg files. MapProp references files located at \MyDocs\Maps
and contain files of type .html.
@FILE_PATH
The FILE_PATH function is provided to work with the external data type property. This function
takes a single argument, evaluated as an external data property, and returns the full path, as a
string, of the file referenced by that property. If the property does not reference a file, this func-
tion returns an empty string. Note that file paths on Windows CE devices do not contain a drive
letter, but rather begin with a single back slash (\).
Arguments:
• edpExternalDataProperty - This argument is evaluated as an external data property by the
function. It is a required argument.
Evaluation Type: String
Supported Return Types:
• String
Examples: In the following examples, SchematicProp references files located at the location
\MyDocs\Schematics and are all .jpg files. MapProp references files located at \MyDocs\Maps
and contain files of type .html.
@FILE_EXTENSION
The FILE_EXTENSION function is provided to work with the external data type property. This
function takes a single argument, evaluated as an external data property, and returns the file exten-
sion, as a string, of the file referenced by that property. If the property does not reference a file,
this function returns an empty string. Note that file paths on Windows CE devices do not contain
a drive letter, but rather begin with a single back slash (\).
Arguments:
• edpExternalDataProperty - This argument is evaluated as an external data property by the
function. It is a required argument.
Evaluation Type: String
Supported Return Types:
• String
Examples: In the following examples, SchematicProp references files located at the location
\MyDocs\Schematics and are all .jpg files. MapProp references files located at \MyDocs\Maps
and contain files of type .html.
@FILE_CHANGED
The FILE_CHANGED function is provided to work with the external data type property. This
function takes a single argument, evaluated as an external data property, and returns A Boolean
value indicating whether or not the referenced file has been modified since it was downloaded
from the Agentry Server. If it has been modified, the function returns TRUE. Otherwise, it will
return FALSE. If the property does not reference a file, this function returns FALSE.
Arguments:
• edpExternalDataProperty - This argument is evaluated as an external data property by the
function. It is a required argument.
Evaluation Type: Boolean
Supported Return Types:
• Boolean
Examples: In the following examples, the MapProp, which is an external data property, has been
modified in the first example, but not in the second.
String Functions
The string functions provided in the rule editor provide the functionality for working with and
manipulating string values. This includes parsing strings, truncating them, searching for specific
values in strings, case conversion, and various other string-related functionality.
Additionally, some of these functions, such as FIND and RFIND, have two forms, the first of
which will perform operations on strings, and the second will work with collections as well. This
functionality is explained where applicable in the following descriptions.
Many of the string functions return both the string data type, as well as others. These functions
manipulate strings, but allow for different return types, based on the needs of the Rule definition.
As with all rules and rule term functions, this is context dependent.
112 Chapter 3 - Rule Term Functions
@CONCATENATE
The CONCATENATE function, as its name implies, concatenates two strings together, returning
the result. This function has two required arguments, which are the two strings to be concatenated
together, and a third optional argument, which is an integral number that specifies the number of
characters in the second string to be used, starting from the left. For example, if two strings,
“John” and “Goes” are to be concatenated, and the third, length argument has a value of 2, then
the resulting string would be “John Go”, not “John Goes”. If this third argument is equal to or
greater then the length of the second argument, the entire string will be returned. If it is 0, only
the first string will be returned.
Arguments:
• strSourceString - This is the first value, evaluated as a string, to which strAddString will
be added. This is a required argument.
• strAddString - This is the value, evaluated as a string, that will be added to the end of
strSourceString. This is a required argument.
• intAddStringLength - This value is evaluated as an integral number and specifies the max-
imum length of the strAddString argument to be added to strSourceString. This argument
is optional and, if not present, the entire strAddString value will be concatenated with
strSourceString.
Evaluation Type: String
Supported Return Types:
• String
Examples:
Property Return: First Order object with Cost greater than 0. If none found, an empty Order
object.
116 Chapter 3 - Rule Term Functions
@LEFT
The LEFT function returns the first N characters from the provided source string, where N is pro-
vided as an argument to the function. The first argument is the source string and the second is the
length of the string returned by the function. If this length is equal to or greater than the length of
the source string, the entire string is returned. If the length is 0 or less, an empty string is returned.
Arguments:
• strSourceString - This argument is evaluated as a string and contains the value that is to be
parsed by the function. This is a required argument.
• intLength - This argument is evaluated as an integral number and specifies the number of
characters, starting from the left most position, to be returned from strSourceString. A 0
intLength value will result in an empty string being returned. A value equal to or greater
than the length of strSourceString will return the entire string unchanged.
Evaluation Type: String
Supported Return Types:
• String
Examples:
@LOWERCASE
The LOWERCASE function converts all alphabetical characters in the source string to lower case
and then returns the result. Any non-alpha characters, such as numbers or symbols are
unchanged, as are any characters that are already lower case.
Arguments:
• strSourceString - This argument is evaluated as a string and is required. It contains the
string value whose alphabetical characters are to be converted to lowercase.
Evaluation Type: String
Supported Return Types:
• String
Examples:
@NEWLINE
The NEWLINE function returns the command characters <CR> <LF>, (0x0D 0x0A), which,
when combined, result in the Windows new line. This return value of this function can be concat-
enated with other strings for formatting purposes.
Arguments: N/A
Evaluation Type: String
Supported Return Types:
• String
Examples:
Examples:
@TAB
The TAB function takes no arguments. It returns a tab <HT> character (0x09). This function is
most often used to insert a tab into a text value for the purpose of formatting.
Arguments: N/A
Evaluation Type: String
Supported Return Types:
• String
Examples:
String Return: “The following are open statuses: Active; Approved; In Progress”
Chapter 3 - Rule Term Functions 129
@TRIM
The TRIM function removes any whitespace characters from the beginning and end of a given
string. Any whitespace within the string is unaffected. The following are considered whitespace
characters and will be removed from the beginning and end of the given source string:
• horizontal tab
• vertical tabs
• space
• newline
• carriage return
• formfeed
Arguments:
• strSourceString - This argument is evaluated as a string and contains the source value
from which whitespace characters will be trimmed. This is a required argument.
Evaluation Type: String
Supported Return Types:
• String
Examples:
@UPPERCASE
The UPPERCASE function converts all alphabetical characters in the source string to lower case
and then returns the result. Any non-alpha characters, such as numbers or symbols, are
unchanged, as are any characters that are already lower case.
Arguments:
• strSourceString - This argument is evaluated as a string and is required. It contains the
string value whose alphabetical characters are to be converted to lowercase.
Evaluation Type: String
Supported Return Types:
• String
Examples:
System Functions
The system functions within the Rule definition type provide access to information about the
Agentry Client application and the system (i.e. the Client Device) upon which it is running. This
information includes the system’s current date and/or time; whether a module of the client appli-
cation is enabled or disabled; whether or not the client is currently offline; and the user ID of the
current user.
This format string will result in a time and date similar to the following:
10:32:04 PM Saturday, December 12, 2001
The t and d characters that begin each string indicate that the format being provided is for the time
or date portion, respectively, of the value. This character is then followed by the equal sign, and
finally the picture of the value to be returned, enclosed in curly braces. The format string within
each of these can consist of specific characters (listed shortly) to provide the desired date and time
format. Any other characters within this string are passed to the result unchanged (such as the
colons in the time or commas in the date of the previous example).
132 Chapter 3 - Rule Term Functions
The following two tables list the time and date formats that can be used in the format string:
Table 3-1 Time Formats
PICTURE DESCRIPTION
H Hours with no leading zero for single-digit hours; 12-hour clock.
Hh Hours with leading zero for single-digit hours; 12-hour clock.
H Hours with no leading zero for single-digit hours; 24-hour clock.
HH Hours with leading zero for single-digit hours; 24-hour clock.
M Minutes with no leading zero for single-digit minutes.
Mm Minutes with leading zero for single-digit minutes.
S Seconds with no leading zero for single-digit seconds.
Ss Seconds with leading zero for single-digit seconds.
T One character time-marker string, such as A or P.
Tt Multi-character time-marker string, such as AM or PM.
Integral Return: The number of days since epoch: e.g, 1590 would be the value returned if the
date is May 9th, 2006.
Decimal Return: The number of days since epoch: e.g, 1590.0 would be the value returned if the
date is May 9th, 2006. Though this is a decimal value, the return will always be whole numbers.
String Return: “May 9th, 2006”
134 Chapter 3 - Rule Term Functions
@DATE_AND_TIME
The DATE_AND_TIME function will return a date and time value that is either the current date
and time of the system, or, if an argument is provided, the date and time value of that argument.
The argument can be a data type of Date and Time, or an number representing the number of sec-
onds since epoch, which is Midnight, January 1st, 2001. Negative values represent dates and
times prior to epoch. The second argument to the function specifies the format of the return value
in a string context. It is ignored in all other contexts.
Arguments:
• DateTimeValue - This argument is evaluated first as a Date and Time property, then, if
found not to be a date property, as an integral value. The function attempts to convert the
value of this argument to a valid Date and Time. This argument is optional and, if not
present, the function will return the current date and time of the system.
• strFomatString - This argument is optional and is only respected by the function if called
in a string context. It specifies the date format of the string returned by the function. If
this argument is not present, the format of the string returned is the one specified by the
client device’s locality settings.
Evaluation Type: Date
Supported Return Types:
• Integral Number
• Decimal Number
• String
Examples:
Integral Return: The number of seconds since epoch; e.g 133200 would be returned for a date and
time of 1:00:00 PM, January 2nd, 2001.
Decimal Return: The number of seconds since epoch; e.g 133200.0 would be returned for a date
and time of 1:00:00 PM, January 2nd, 2001. Though this is a decimal return, the value will
always be a whole number.
String Return: 1:00:00 PM, January 2nd, 2001.
Chapter 3 - Rule Term Functions 135
@TIME
The TIME function will return a time value that is either the current time of the system, or, if an
argument is provided, the time value of that argument. The argument can be a data type of either
Time, or an integral number representing the number of seconds since midnight. Negative
numeric values should not be passed as an argument to the function. This argument may also be a
string value containing a time, such as 3:34:05 PM, which will also be converted to a time by the
function. This conversion is dependent on the configuration of the client device and its set locale.
If the function is unable to convert the given argument to a valid time, whether it be a numerical
value, or a string, the function will ignore the given argument and return the current time of the
client device.
Arguments:
• TimeValue - This argument is evaluated first as a Time property, then, if found not to be a
time property, as an integral value, and, finally, a string. The function attempts to convert
the value of this argument to a valid Time. This argument is optional.
• strFomatString - This argument is optional and is only respected by the function if called
in a string context. It specifies the time format of the string returned by the function. If
this argument is not present, the format of the string returned is the one specified by the
client device’s locality settings.
Evaluation Type: Date
Supported Return Types:
• Integral Number
• Decimal Number
• String
Examples:
Integral Return: The number of seconds since Midnight; e.g. 38742 would be returned for a time
of 10:45:42 AM.
Decimal Return: The number of seconds since Midnight; e.g. 38742.0 would be returned for a
time of 10:45:42 AM. While this is a decimal value, the return will always be a whole number.
String Return: “10:45:42”
136 Chapter 3 - Rule Term Functions
@MODULE_ENABLED
The MODULE_ENABLED function returns either TRUE or FALSE indicating whether or not
the specified module is enabled or disabled, respectively. It will also return FALSE if the function
named in its argument does not exist on the Client.
Arguments:
• strModuleName - This argument is evaluated as a string and is treated as an internal name
for a module definition. The function will evaluate the named module definition to deter-
mine if it exists and if it is enabled.
Evaluation Type: Boolean
Supported Return Types:
• Boolean
Examples: In the following examples, the module Customers is defined and is enabled in the cli-
ent. The module Orders is not enabled.
@USERID
The USERID function, as its name implies, returns the user ID of the user currently logged into
the Agentry Client. This is the ID entered by the user to log into the Client, not their Windows
login. This function takes no arguments.
Arguments: N/A
Evaluation Type:
Supported Return Types:
• String
Examples:
Table Functions
The table functions in the Rule definition type allow access to individual records within Complex
Tables and Data Tables on the Agentry Client. The unique value for the desired record must be
known, as must the table name, to retrieve the desired record.
Within the Rule Editor, there are four functions listed in this category, two for complex tables
(BHT and COMPLEX TABLE) and two for data tables (DT and TABLE). However, both the
BHT and COMPLEXTABLE function perform the same operation with the exact same argu-
ments expected. Likewise, the DT and TABLE functions also are identical in both argument list
and behavior. Therefore, the topics in this section will described the COMPEXTABLE and
TABLE functions only.
140 Chapter 3 - Rule Term Functions
@COMPLEXTABLE
The COMPLEXTABLE function returns the specified field from a record in a complex table,
based on the provided search information. This function takes a variable number of arguments,
but must be provided at least two. The first argument is always the name of the complex table to
be searched. The second argument is always a search value. The remaining optional arguments
include additional search values for multi-indexed tables where indexes are structured in a parent-
child relationship, the index to be used to search, and the field from the record to be returned by
the function.
If no search index is specified, the unique index for the table will be used to perform the search. If
no return field is specified, the field upon which the unique index has been defined will be
returned.
If a complex table record is to be retrieved using a search index that is a child index, then that
child index should be provided as an argument to the function. Additionally, there must be one
search value for each indexed field for the ancestors of the child index. So, index C has a parent if
index B, which in turn has a parent of index A. A search value for field C, one for field B, and
one for field A must be provided to the function to perform the search.
Arguments:
• strTableName - This argument is evaluated as a string and contains the name of the com-
plex table to be searched by the function. This is a required argument.
• searchValue1 - This argument is evaluated as the data type of the argument value. It con-
tains the search value for which the record is located in strTableName.
• searchValueN - This argument is evaluated as the data type of the argument value. It con-
tains the search value, in combination with searchValue1, for which the record is located
in strTableName. This argument is required only if the search index argument to the func-
tion is a child index. There must be as many searchValue arguments as their are indexes
above the search index in the hierarchy.
• strIndexName - This argument is evaluated as a string and specifies the index to be used to
search for the desired record in the strTableName complex table. This argument is option-
al. If not provided, the unique index of the complex table is used for the search.
• strReturnFieldName - This argument is evaluated as a string and contains the name of the
field whose value is to be returned by the function when the desired record is found. This
argument is optional and, if not present, the field indexed by the unique index of the table
is the value returned.
Evaluation Type: Context Dependent
Supported Return Types:
• Boolean
• Decimal Number
• Integral Number
• String
Chapter 3 - Rule Term Functions 141
Examples: In the following examples, the complex table being searched is listed next.
Table 3-3 Customers Complex Table
ID CUSTOMERNAME CITY STATE ZIPCODE
11254 Acme Insurance Chicago IL 60610
11478 Smith Auto Body New York NY 10928
11928 Tom’s Mini-Mart Los Angeles CA 90211
Hoffman
19283 Beef Village IL 60194
Estates
53648 Home Fixit Center Buffalo NY 10029
31291 Anthony’s Yogurt Stand San Diego CA 90941
Arguments:
•
Evaluation Type:
Supported Return Types:
•
Examples: