Embedding Expressions in String Fields

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  The FlowForce Expression Language >

Embedding Expressions in String Fields

To use a FlowForce expression in a string field, enclose the expression within curly braces, that is, the "{" and "}" characters. The expression part of a string field normally has a light purple background, which helps you distinguish the expression part from the rest of the string, for example:

expression_in_string05

In a string field, only the expression enclosed within curly braces will be treated by FlowForce as an expression. If you want FlowForce to interpret the "{" and "}" characters literally, write double braces instead of a single brace. Consider the following cases:

 

A string field with the following value...

Will be evaluated as...

Explanation

expression_in_string01

echo Hello, World!

The string does not use any curly braces (it does not contain an embedded expression), so it is evaluated as is.

expression_in_string02

-

The string cannot be evaluated. The embedded expression is not syntactically correct, so FlowForce displays a syntax error.

expression_in_string03

echo Hello, World!

The string contains an embedded expression which is syntactically correct. However, the expression is inside a string field, so the evaluation result would be the same if you used no expression at all (see the first example above).

expression_in_string04

echo {'Hello, World!'}

The string does not contain an expression, since the escape characters {{ and }} were used.


© 2019 Altova GmbH