Name

adams.flow.transformer.LookUpUpdate


Synopsis

Updates the lookup table (in form of a spreadsheet) that passes through using the specified rules.
The rules can contain variables.

The rules use the following grammar:

expr_list ::= expr_list expr_part | expr_part

expr_part ::= conditional | assignment

conditional ::= if expr then assignments end
                | if expr then assignments else assignments end

assignments ::= assignments assignment | assignment
assignment ::=
                VARIABLE := expr;
              | all ( "regexp" ) := expr;

expr ::= ( expr )
              | NUMBER
              | STRING
              | BOOLEAN
              | VARIABLE

              | true
              | false

              | -expr

              | expr < expr
              | expr <= expr
              | expr > expr
              | expr >= expr
              | expr = expr
              | expr != expr

              | not expr
              | expr and expr
              | expr or expr

# string functions
              | substr ( expr , start [, end] )
              | left ( expr , len )
              | mid ( expr , start , len )
              | right ( expr , len )
              | rept ( expr , count )
              | concatenate ( expr1 , expr2 [, expr3-5] )
              | lower[case] ( expr )
              | upper[case] ( expr )
              | trim ( expr )
              | matches ( expr , regexp )
              | len[gth] ( str )
              | find ( search , expr [, pos] ) (find 'search' in 'expr', return 1-based position)
              | contains ( str , find ) (checks whether 'str' string contains 'find' string)
              | replace ( str , pos , len , newstr )
              | replaceall ( str , regexp , replace ) (applies regular expression to 'str' and replaces all matches with 'replace')
              | substitute ( str , find , replace [, occurrences] )
              | str ( expr )
              | str ( expr , numdecimals )
              | str ( expr , decimalformat )

              | expr + expr
              | expr - expr
              | expr * expr
              | expr / expr
              | expr % expr
              | expr ^ expr

              | abs ( expr )
              | sqrt ( expr )
              | cbrt ( expr )
              | log ( expr )
              | log10 ( expr )
              | exp ( expr )
              | sin ( expr )
              | sinh ( expr )
              | cos ( expr )
              | cosh ( expr )
              | tan ( expr )
              | tanh ( expr )
              | atan ( expr )
              | atan2 ( exprY , exprX )
              | hypot ( exprX , exprY )
              | signum ( expr )
              | rint ( expr )
              | floor ( expr )
              | pow[er] ( expr , expr )
              | ceil ( expr )
              | min ( expr1 , expr2 )
              | max ( expr1 , expr2 )
              | has ( variable )

Notes:
- Variables are either all alphanumeric and -/_ (e.g., "ABc_1-2"), any character
  apart from "]" enclosed by "[" and "]" (e.g., "[Hello World]") or
  enclosed by single quotes (e.g., "'Hello World'").
- The 'all' method applies the value to all the values in the lookup table
  that match the regular expression.
- Positions are 1-based.
- 'str' uses java.text.DecimalFormat when supplying a format string
- Variables starting with '_' (inside the [] or '') are considered local and don't get transferred back out.
- The 'has' function checks whether a variable/symbol is present.


Additional information

Flow input/output:
- input: adams.data.spreadsheet.SpreadSheet
- output: adams.data.spreadsheet.SpreadSheet


Options