Skip to main content
The Parser class is a template engine. Use an instance to set template variable values, then parse a formatted string containing template variable placeholders to replace their values.
This example defines the template and its variables inline. You can also use a reply template.

List available variables

You can use the variable PARSER_TREE in double square brackets to print a list of all available variables.

Define data

Void toParser(Parser parser)

Copies a set of values to the parser.

Void setVariable(String name, String value)

Sets a named variable to the given value in the parser. If this variable already has a value, the old value will be overwritten with the new value.

Void addVariable(String field, String value)

Similar to setVariable().

Get info

String getVariable(String name, Integer row)

Retrieves the value of a named variable at the given index.

Run parser

String parseString(String stringToParse)

Parses a text and returns the result.

String evaluateString(String stringToParse)

Parses the text and returns the outcome of a RETURN statement within the text.

Statistics

Integer getVariableCount(String name)

Counts the occurrences of a named variable in the parser instance.