All those formulas
- Calculating Point
JReport gives Formula three chances to be executed. These chances are called Calculating Point.
formula1 + formula1 = 2 * formula1.
This differs from other programming languages, such as C++ or Java.
s. Others can only be seen in the body of a formula.
- Identifier scope
Formula names, global variables, Database fields and Parameters can be seen through all Catalog
- Statement
Statement is the smallest executable unit in Formula. Only the result of a statement can be used as the result of the Formula which contains the statement.
- Summary & By-record Formula
If the result of a formula is a statistics of a group, this formula is called Summary formula. It will be executed only once within its group. The other kinds of formula are called By-record Formula.
formula : gVarDeclStmts | statements | gVarDeclStmts ';' statements;
statements : statement | statements ';' statement;
gVarDeclStmts : gVarDeclStmt | gVarDeclStmts ';' gVarDeclStmt;
gVarDeclStmt : TKGLOBAL basictype typedescriptor gvarlist;
gvarlist : gvar | gvarlist ',' gvar;
gvar : TKNAME | TKNAME '=' expression | TKNAME '[' arraysize ']' | TKNAME '[' arraysize ']' '=' expression;
statement : emptystmt | exprstmt | lVarDeclStmt | ifelsestmt | returnstmt | compoundstmt;
ifelsestmt : ifpart elsepart;
ifpart : TKIF '(' expression ')' then statement;
then : | TKTHEN;
elsepart : | TKELSE statement;
compoundstmt : '{' statementlist '}' ;
statementlist : statement | statementlist ';' statement;
returnstmt : TKRETURN expression;
emptystmt : exprstmt : expression;
lVarDeclStmt : basictype typedescriptor lvarlist;
lvarlist : lvar | lvarlist ',' lvar;
lvar : TKNAME | TKNAME '=' expression | TKNAME '[' arraysize ']' | TKNAME '[' arraysize ']' '=' expression;
arraysize : | expression;
basictype : TKNUMBER | TKCURRENCY | TKSTRING | TKBOOLEAN | TKDATE | TKTIME | TKTIMESTAMP;
typedescriptor : | TKRANGE;
expression : TKCONSTFLOAT | TKCONSTSTRING | TKTRUE | TKFALSE | '(' expression ')' | expression '+' expression | expression '-' expression | expression '*' expression | expression '/' expression | expression '%' expression | expression TKOR expression | expression TKAND expression | '!'expression | expression '<' expression | expression '>' expression | expression TKGE expression // >= | expression TKLE expression // <= | expression TKEQ expression // == | expression TKUNEQ expression // <> != | expression TKIN expression | '-' expression %prec UMINUS | '$' expression | function | variable // variable or global variable | SpecialVariable | expression '['subscriptexpr ']' | '[' expression arrayrange ']' | variable '=' expression;
subscriptexpr : expression | subrange //expression TKTO expression;
arrayrange : array | range;
array : | ',' arrayelements;
arrayelements : expression | arrayelements ',' expression;
range : TKTO expression;
subrange : expression TKTO expression;
variable : TKNAME;
function : funcname '(' paramlist ')';
funcname : TKNAME;
paramlist : | expression | paramlist ',' expression;
SpecialVariable : '@' spvarname;
spvarname : TKNAME | TKCONSTSTRING;