Dynamic Content / Formulas
In some user-defined areas, dynamic content based on a simple formula language can be used in addition to static content
(fixed texts). These always begin with =
. In terms of content, data from the ESR and the config (data from company,
location and terminal) can be accessed. This occurs when the field is specified within curly brackets (e.g. ={Cfg.Cmp.Label}
).
Fixed texts in formulas must be placed under apostrophes (e.g. ='fixed text'
). Different contents can be put together using +
(e.g. ='Customer: '+{ESR.Ctm.Nam}
). A number of functions are also supported that make handling values and texts easier. In
addition to combining values, the arithmetic operations +
, -
, *
, /
and %
can also be used to range values.
Extended access to data from lists (e.g. from positions, head or foot) can be made using square brackets (e.g. ={ESR.Foot[1]}
)
where the counting starts at 0 for the first element. Instead of the index, a condition can also be inserted that allows access
to a list entry based on a check (e.g. {ESR.Foot['_'="barcode"].value}
)
Please note that JavaScript is being executed in the background to calculate the values. Certain operations such as using +
in combination with both text and numbers will behave according to the JavaScript standard.
The parameters that are passed into the functions can also be the results of other function calls. It is therefore possible to
interconnect calls. Example: =SLICE(REPLACE('abcde','a','1'),1,3)
Supported functions
SLICE
Usage / Syntax: SLICE(value, start, [end])
Description: Returns a defined part of a text or a list.
value
= value / text / liststart
= start index (starting at 0)end
: (optional) end index (this index will not be included)
Example: =SLICE('abcde',1,3)
Result: 'bc'
REPLACE
Usage / Syntax: REPLACE(value, search, replace)
Description: Replaces parts of one value with another.
value
= text which to search forsearch
= specific value within text to be replacedreplace
= replacement value for all occurrences of said value
Example: =REPLACE('abcde','a','1')
Result: '1bcde'
REPLACEREGEX
Usage / Syntax: REPLACEREGEX(value, regex, replace)
Description: Replaces parts of a value found by one regex with another.
value
= text which to search forregex
= a regex string used to find the values which should be replacedreplace
= replacement value for all matches of the regex
Example: =REPLACEREGEX('a1b2c3','\d','_')
Result: 'a_b_c_'
PARSEINT
Usage / Syntax: PARSEINT(value, [radix])
Description: Attempts to interpret a given value as an integer.
value
= the value to be interpretedradix
= (optional) number that can be used as a basis for the interpretation (e.g. 10 for decimal numbers (e.g. 123), 16 for hexadecimal numbers (e.g. 7B) or other number systems)
Example: =PARSEINT('7B',16)
Result: 123
PARSEFLOAT
Usage / Syntax: PARSEFLOAT(value)
Description: Attempts to interpret a given value as a float (decimal number).
value
= the value to be interpreted
Example: =PARSEFLOAT('010.50')
Result: 10.5
TOFIXED
Usage / Syntax: TOFIXED(value, [digits])
Description: The decimal number contained in the value is rounded to the specified number of decimal places.
value
= value to be rounded, 'digits' = (optional) number of decimal places to be determined
Example: =TOFIXED(10.508,2)
Result: 10.51
TOUPPERCASE
Usage / Syntax: TOUPPERCASE(value)
Description: Converts all letters in the specified value to uppercase.
Example: =TOUPPERCASE('aBc')
Result: ABC
TOLOWERCASE
Usage / Syntax: TOLOWERCASE(value)
Description: Converts all letters in the specified value to lowercase.
Example: =TOLOWERCASE('Abc')
Result: abc
LINEBREAK
Usage / Syntax: LINEBREAK(count)
Description: Adds a number of line breaks \r\n
to the final value.
count
= the number of line breaks to be added. At least 2 are required for blank lines.
Example: =LINEBREAK(2)
Result: \r\n\r\n