Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
This page is for anyone who needs to embed expressions within wider statements.
Overview
To embed an expression within a statement or text:
- Prefix with
$
- Enclose the expression within curly brackets
${ … }
For example, an email can include the title and surname of the recipient.
Note |
---|
dfdlf;a |
Cp panel macro |
---|
Dear |
Dear Mr ${in.name}, your subscription for 'Owl Monthly' will be renewed shortly. The fee of GBP${in.amount} will be collected from your bank on ${toString(in.renewalDate, 'dd MMMM')}. Yours Sincerely, Friends of the Owl Society
The expressions are evaluated at run-time and the results either inserted back into the outer statement or retained as separate parameters according to the language rules.
The variables that can be referenced in embedded expressions vary according to context.
Statement Language Rules
The rules for embedding expressions depend on the language of the statement.
Text
All results of embedded expressions are inserted back into the statement.
${…} expressions are ignored inside single quotes, double quotes and ‘--’ comments.
An embedded expression is ended by the first '}', regardless of the content of the expression.
{…} may also be used to embed expressions in statements, although this usage is discouraged / deprecated.
If the first character of the embedded expression is '=', this character is ignored.
SQL
Same as for Text, except
If the first character of the embedded expression is ‘=', the result of evaluating the expression, after stripping off the leading '=’, is inserted as text back into the statement. This is the way you would pass in the name of the table to insert into (if the table name were variable).
If the first character of the embedded expression is not '=', the result of evaluating the expression is passed as a separate parameter to the JDBC driver. This is the way you would generally pass the values to be inserted into a table row.
XML
Same as for Text.
HTML
Same as for Text.
JSON
All results of embedded expressions are inserted back into the statement as text.
${…} expressions are recognised inside matching single or double quotes in the statement.
An embedded expression is ended by the first '}' provided that it is outside matching single / double quotes within the expression.
The {…} form of embedded expressions is not valid.
$$ can be used to escape a single $ into the statement without marking the start of an embedded expression.
Panel | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
|