Expression Objects
Using MQL, expressions can be created and saved in the database to be evaluated against a business object, a connection, or from within a webreport, against a collection of business objects or connections. Once created, saved expressions can be referenced by name in a business object or connection select clause. Since select clauses can be embedded in expressions, they can be used in where clauses and access filters as well. Expression objects can also be referenced by name in webreports.
If-Then-Else
if EXPRESSION1 then EXPRESSION2 else EXPRESSION3
eval expr' if (attribute[Actual Weight] > attribute[Target Weight]) then ("OVER") else ("OK")' on bus 'Body Panel' 610210 0;
Substring
substring FIRST_CHAR LAST_CHAR EXPRESSION
eval expression 'substring -4 -1 attribute[Phone Number]' on bus Vendor 'XYZ Co.' 0;
Dateperiod
add expr QuarterlyDeliverables value 'dateperiod fq07 attribute[DueDate]';
Using Dates in Expressions
evaluate expr '(MX_CURRENT_TIME - state[Released].actual) / 3600' on bus 'Body Panel' 610210 0;
Count sum maximum minimum average median standarddeviation correlation
eval expr 'count TRUE' on temp query bus 'Body Panel' * *;
add expr LowCost value 'attribute[cost]>=10 AND attribute[cost]<=50';
eval expr 'count expression[LowCost]' on set NewBooks;
Example
evaluate expression "(average (state[Test].actual - state[Open].actual) )/ (3600 * 24)" on expand Product XYZ v7.0 to relationship Committed, Candidate, Proposed type Feature where "current == Test or current == Closed" on expand Product XYZ v7.1 to relationship Committed, Candidate, Proposed type Feature where "current == Test or current == Closed" dump "|";