R/G Expression Explanations And Examples
There are many things to consider when entering a valid expression. Below please find some explanations and rules along with some examples.
Order of expression evaluation.
Anything enclosed in parenthesis gets evaluated first.
The expression is evaluated from left to right.
Certain Special Functions are assigned a higher priority and are evaluated in the following order.
1st ^
5th AND
6th OR
Sample #1 - Expression 1 + 2 * 5 + 8 equals 19
1st - 2 * 5 equals 10 1 + 2 * 5 + 8
2nd - 1 + 10 equals 11 1 + 10 + 8
3rd - 11 + 8 equals 19 11 + 8
Sample #2 - Expression (1 + 2) * (5 + 8) equals 39
1st - 1 + 2 equals 3 (1 + 2) * (5 + 8)
2nd - 5 + 8 equals 13 3 * (5 + 8)
3rd - 3 * 13 equals 39 3 * 13
What makes up an expression.
Numeric literals - Any valid number (i.e. 1, 2, 3, 4.25, etc.)
String literals - Any set of characters enclosed in quotation marks (i.e. "ABC", "Hello!", "123ABC", etc.)
Special Functions - Functional or mathematical portions of an equation (i.e. <, +, MID(, (), AND)
Space - Spaces are used to make expressions more readable and separate the parts of the expression.
Field names - Short names that describe the different fields displayed in the Field List. See Insert Field Name to find out the easiest way to insert a valid field name. All field names have the following format:
Prefix | File List Item | Exclamation Point | Field List Item | Actual Field Name |
dta | GLActMst | ! | HInd | dtaGLActMst!HInd |
dta | UTCmpMst | ! | CompName | dtaUTCmpMst!CompName |
Sample #1 - dtaGLActMst!HInd
FIELD NAME is dtaGLActMst!HInd
dtaGLActMst!HInd
TRANSLATION: (For a description of how field names are translated see Insert Field Name.)
|
RESULT TYPE:
Sample #2 - (dtaGLActMst!CurYrBegBal <> 0) AND (dtaGLActMst!HInd = "D")
SPECIAL FUNCTIONS are ( <> ) AND ( = )
(dtaGLActMst!CurYrBegBal <> 0) AND (dtaGLActMst!HInd = "D")
NUMERIC LITERAL is 0
(dtaGLActMst!CurYrBegBal <> 0) AND (dtaGLActMst!HInd = "D")
STRING LITERAL is "D"
(dtaGLActMst!CurYrBegBal <> 0) AND (dtaGLActMst!HInd = "D")
SPACES USED are
(dtaGLActMst!CurYrBegBal <> 0) AND (dtaGLActMst!HInd = "D")
FIELD NAMES are dtaGLActMst!CurYrBegBal dtaGLActMst!HInd
(dtaGLActMst!CurYrBegBal <> 0) AND (dtaGLActMst!HInd = "D")
TRANSLATION:
|
RESULT TYPE:
Other rules for setting up an expression.
Left parenthesis must have a matching right parenthesis following it.
Right parenthesis must have a matching left parenthesis preceding it.
Every string literal MUST begin with a quotation mark and end with a quotation mark.
String variables, string literals or true/false variables can NOT be directly compared to numeric variables or numeric literals.
Some examples of expressions that can be used for an If Condition.
Example #1 - dtaGLActMst!HInd = "D"
TRANSLATION:
|
RESULT TYPE:
REASON FOR EXPRESSION:
This report will only print detail G/L accounts.
Example #2 - LEFT(dtaGLTJEHdr!TJEDt, 6) = LEFT(DATE, 6)
TRANSLATION:
|
RESULT TYPE:
REASON FOR EXPRESSION:
This report will only print temporary journal entries that are dated in the current month.
Example #3 - QTD(DATE, dtaPRUnemp, Amt) <> 0
TRANSLATION:
|
RESULT TYPE:
REASON FOR EXPRESSION:
This report will only print employees if their quarterly unemployment amount is not zero.
Example #4 - dtaBIOnHand!SerNo > "" AND dtaBIOnHand!Qty > 0
TRANSLATION:
|
RESULT TYPE:
REASON FOR EXPRESSION:
This report will only print a line if there is a serial number AND the quantity is greater than 0.