Summary
Formula interpreter 3.0
Getting started | Core idea is to let define users rules either directly (e.g. via editable Grid) It allows testing a solution and makes calculations and results visible. |
Define a table for the formula interpreter. | For the formula interpreter you need a table with the following columns:
|
Insert the operation, choose the suitable columns, define names for the description column and the error column and define the formatting of the number values. PLEASE NOTE:
Indices are used like this: [L215](1), or if there are several indices [L215](2,2) | |
Calculation | As soon as the formula field is defined, the formula interpreter tries to solve the formula and overwrite the value filed.
|
Result |
|
Configuration
Input settings of existing table
Parameter | Value | Opt. | Description | Example |
---|---|---|---|---|
Identifier | System.Object | opt. | Which columns should be evaluated for the identifier? | - |
Variable column | System.String | - | Column containing the name of the variable. | - |
Variables index column | System.Int32 | opt. | Index columns for variable arrays | - |
Formula column | System.String | - | Column containing the formula. | - |
Value column | System.Double | - | Column containing the value of the variable. | - |
Global variable column | System.Boolean | opt. | Column used to specify that this line contains a global variable (valid for all identifiers). | - |
Trace column | System.Boolean | opt. | Column used to specify that only this line including its predecessors (on which the calculation is based) will be displayed. | - |
Settings
Parameter | Value | Opt. | Description | Example |
---|---|---|---|---|
Name of description column | System.String | - | - | - |
Name of error column | System.String | - | - | - |
Name of direct errors column | System.String | opt. | - | - |
Debug Mode | System.Boolean | - | - | - |
Format string for small numbers | System.String | - | - | - |
Format string for large numbers | System.String | - | - | - |
Format string for percentages | System.String | - | - | - |
Limit sm/la numbers (+/-) | System.Double | - | - | - |
/* converted on Wed Jan 20, 2016, 15:17 (UTC+01) by antlr_3-to-w3c v0.35.1152 which is Copyright (c) 2011-2015 by Gunther Rademacher <grd@gmx.net> */
xformula ::= xformula_expression EOF
xformula_expression
::= xformula_logicalandexpr
xformula_logicalandexpr
::= xformula_logicalorexpr ( '&&' xformula_logicalorexpr )*
xformula_logicalorexpr
::= xformula_compareexpr ( '||' xformula_compareexpr )*
xformula_compareexpr
::= xformula_sumexpr ( ( '==' | '!=' | '>' | '>=' | '<' | '<=' ) xformula_sumexpr )*
xformula_sumexpr
::= xformula_prodexpr ( ( '+' | '-' ) xformula_prodexpr )*
xformula_prodexpr
::= xformulaexpr ( ( '*' | '/' ) xformulaexpr )*
sign ::= '+'
| '-'
primary_expression
::= numeric_constant
parameter
::= xformula_expression
| xformulaexpr
| '(' xformula_expression ')'
xifunc ::= '#' XIFUNCIDENTIFIER '(' parameter* ( ',' parameter )* ')' '#'
function ::= FUNCTIONIDENTIFER '(' parameter ( ',' parameter )* ')'
vardef ::= VARIDENTIFIER ( '(' parameter ( ',' parameter )* ')' )*
compareop
::= '=='
| '!='
| '>'
| '>='
| '<'
| '<='
op ::= '+'
| '-'
| '/'
| '*'
numeric_constant
::= INTEGER
| DOUBLE
xformulaexpr
::= vardef
| function
| '-'* primary_expression
| op
| compareop
| xifunc
| CHARACTER_LITERAL
| STRING_LITERAL
| '(' xformula_expression ')'
<?TOKENS?>
BOOLEAN ::= 'true'
| 'false'
| 'True'
| 'False'
ESCAPELDELIM
::= '\' '['
ESCAPERDELIM
::= '\' ']'
INTEGER ::= DIGIT+ INTEGER_TYPE_SUFFIX?
DOUBLE ::= ( DIGIT* '.' )? DIGIT+ REAL_TYPE_SUFFIX?
INTEGER_TYPE_SUFFIX
::= 'I'
| 'i'
REAL_TYPE_SUFFIX
::= 'F'
| 'f'
VARIDENTIFIER
::= '[' ( ESCAPEDELIM | [^[#x5D] )+ ']'
FUNCTIONIDENTIFER
::= ( UPPER | LOWER ) ( UPPER | LOWER | DIGIT )*
XIFUNCIDENTIFIER0
::= '#' XIFUNCIDENTIFIER
XIFUNCIDENTIFIER
::= 'XI.TIS' UPPER LETTERS*
ESCAPEDELIM
::= ESCAPELDELIM
| ESCAPERDELIM
LOWER ::= [a-z]
UPPER ::= [A-Z]
SPECIALS ::= [ -@#x80-#xFF]
LETTER ::= LOWER
| UPPER
| SPECIALS
LETTERS ::= LOWER
| UPPER
DIGIT ::= [0-9]
ESCAPESEQUENCE
::= '\' ( 'b' | 't' | 'n' | 'r' | '"' | "'" | '\' )
CHARACTER_LITERAL
::= "'" ( ESCAPESEQUENCE | [^'\] )* "'"
STRING_LITERAL
::= '"' ( ESCAPESEQUENCE | [^"\] )* '"'
WS ::= [ #x9#xA#xD]+
COMMENT? ::= '/*' .* '*/'
EOF ::= $
Want to learn more?
Troubleshooting
Nothing known up to now.
Related topics
- Operators (alphabetical overview)
- Uses ANTLR internally.