Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Insert excerpt
_Banners
_Banners
namephixScript
nopaneltrue

This page is for anyone who needs to embed expressions within wider statements.

Overview

To embed an expression within a statement or text:

  1. Prefix with $
  2. Enclose the expression within curly brackets

${ … }


For example, you can use expressions within the text of an email

can include the title and surname of the

to include details specific to each recipient.

note
Panel

dfdlf;a

cp-panel-macro
titleExample

Dear ${in.

title

title} ${in.

name

surname},

your


Your subscription for 'Owl Monthly' will be renewed shortly. The fee of

GBP$

GBP${in.amount} will be collected from your bank on ${toString(in.renewalDate, 'dd MMMM')}. Yours Sincerely,

Friends of the Owl Society

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

Embedded expressions are evaluated at run-time and the results are:

  • either inserted back into the outer statement
  • or retained as separate parameters according to the
language rules

The variables that you can

be referenced

reference in embedded expressions

vary according to

depend on context.

Statement Language

Rules

Rules 
Anchor
rules
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

, XML and HTML

${…} is the recommended syntax, although the $ can be omitted.

${…} expressions are ignored when they are inside:

  • single quotes
,
  • double
quotes and
  • quotes 
  • --’ comments.
An

If the first character of the embedded expression is an equals sign =, this character is ignored.

The embedded expression is ended by the first

'

closing curly bracket }

'

, regardless of the content of the expression.

The result of evaluating the expression is inserted into the statement.

SQL

${…}

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

is the recommended syntax, although the $ can be omitted.

${…} expressions are ignored when they are inside:

  • single quotes
  • double quotes 
  • --’ comments.

The embedded expression is ended by the first closing curly bracket }, regardless of the content of the expression.

How the result of the evaluating the expression is used depends on the first character of the embedded expression

is ‘=', the

. Where the first character:

  • is an equals sign =, it is stripped before the expression is evaluated. 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 '='
  • how to pass a variable representing a table name and then insert something into the table.
  • is not an equals sign, 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
  • how to pass 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

JSON

${…} is the required syntax. JSON uses curly brackets, so the $ acts as an escape character.

${…} expressions are recognised

inside matching single or double quotes in the statement.An

in a statement even when they are inside:

  • single quotes
  • double quotes.

The embedded expression is ended by the first

'}' provided

closing curly bracket that it is outside

matching

any single / double

quotes

quote pairs within the expression

.The {…} form of embedded expressions is not valid

.

$$

can be used to escape

escapes a single $

into Table of Contentsindent12pxstylenone

in the statement, without marking the start of an embedded expression.

Panel
borderColor#7da054
titleColorwhite
titleBGColor#7da054
borderStylesolid
titleSections on this page

The result of evaluating the expressions is inserted into the statement as text.