Template content

The template of a template line, after DISPLAY or in a clause of a conditional display, is the content that EFX displays. It is a series of fragments written next to each other: text, label blocks, expression blocks, line breaks and hyperlinks. White space between and inside the fragments stays. This page describes each kind of fragment.

Text

EFX displays text in a template as you write it.

Syntax
<characters>
<characters>

any characters except the special characters listed below, and except the end of the line.

EFX copies text to the displayed content. Spaces and tabs inside the template stay, also several spaces in a row. EFX ignores white space at the start and at the end of the template (see DISPLAY).

Some characters have a special meaning in templates:

Character Meaning

$

starts an expression block (${…}) or the shorthand $value

#

starts a label block (#{…}) or the shorthand #value

@

starts a hyperlink (@{…})

&

starts a character reference

\

starts an escape sequence or a line break (\n), or joins lines of the file (see Line terminator and line joining)

:

separates the caption of a template from its content

;

ends the template line

//

after a space or a tab, starts a comment

To display one of these characters, write a character reference: &#36; for $, &#35; for #, &#64; for @, &amp; for &, &#92; for \ and &#59; for ;. For a colon that is text, write \: (see Caption). A text literal in an expression block, such as ${'$'}, also displays the character. Braces ({ and }) are ordinary characters in text.

The words WHEN, OTHERWISE and INVOKE, in upper case, are keywords when they follow white space or a colon in a template. To display such a word, write it in an expression block, for example ${'WHEN'}, or write its first letter as a character reference, for example &#87;HEN. In lower case, or with upper and lower case mixed, as when or When, these words are ordinary text.

Restrictions

  • $ must be followed by { or by value, # by { or by value, and @ by {. Otherwise it is an error.

  • & must start a character reference. A lone & is an error.

  • \ must start an escape sequence or a line break, or join lines of the file. Otherwise it is an error.

  • # followed by the name of a label type, such as #name, is an error. You write label types in a label block: #{name}.

Examples

WITH BT-00-Number DISPLAY Total: ${BT-00-Number} items {see the list below};

Text around an expression block. The braces are displayed.

WITH BT-00-Number DISPLAY Price: ${BT-00-Number} &#36; &amp; more&#59; see section &#35;3;

Displays $, &, ; and # with character references.

WITH BT-00-Text DISPLAY Contact: info&#64;example.com;

Displays Contact: info@example.com.

WITH BT-00-Text DISPLAY Available when published;

The word when, in lower case, is ordinary text.

WITH BT-00-Text DISPLAY Status: ${'WHEN'} PUBLISHED;

Displays the word WHEN, which would otherwise be read as a keyword.

In EFX-1, the characters @, &, \ and ; and the words WHEN, OTHERWISE and INVOKE were ordinary text. If template text written for EFX-1 contains them, you must adapt it.

See also: Text literal

Escape sequences and character references

With character references, you write characters that have a special meaning in templates, or that are difficult to type. With escape sequences, you can write a backslash in template text.

Syntax
&<entity-name>;
&#<decimal-number>;
&#x<hexadecimal-number>;
\<character>
<entity-name>

the name of a character, made of letters, as in HTML: for example amp, lt, gt, copy.

<decimal-number>, <hexadecimal-number>

the code of a Unicode character, in decimal or in hexadecimal digits (the x can also be written X).

<character>

one of d, D, w, W, s, S, t, r, v, f, b, c, x, u, 0, ", ', \ and :.

A character reference stands for one character, as in HTML: &amp; for &, &lt; for <, &#169; and &#xA9; for ©. The template translator passes character references on unchanged to the application that displays the notice, which displays the characters that they stand for.

An escape sequence is a backslash followed by one of the characters listed above. The template translator does not interpret escape sequences: it passes them on as written, backslash included. The only exception is \:, which stands for a colon that is text, and which EFX displays as : (see Caption). Escape sequences exist so that you can write a backslash in template text. The sequence \n is a line break (see Line break), and a backslash at the end of a line of the file joins the next line (see Line terminator and line joining).

Restrictions

  • A backslash followed by any other character, such as \%, \$ or \;, is an error.

  • A character reference must end with a semicolon.

Examples

WITH BT-00-Text DISPLAY Terms &amp; conditions &#169; 2026 &#xA9; &copy;;

A named character reference and three ways of writing the copyright sign. The last semicolon ends the template line.

WITH BT-00-Text DISPLAY Path: C\:&#92;notices&#92;2026;

The caption Path and the content C:\notices\2026, with a character reference for each backslash and \: for the colon of the content.

WITH BT-00-Text DISPLAY Format: \d\d/\d\d;

Escape sequences in text. The template translator passes the content \d\d/\d\d on as written.

Character references and escape sequences are new in EFX-2.

See also: Text literal

Line break

\n in a template starts a new line in the displayed content, without starting a new template line.

Syntax
<fragment>\n<fragment>
<fragment>

any fragment of the template. Optional: a line break can start or end the template.

EFX displays a line break as a new line inside the content of the same template line. The content after it has the same context and belongs to the same template block. EFX ignores spaces and tabs before and after \n. Several line breaks in a row display empty lines.

Examples

WITH BT-00-Text DISPLAY #{name}:\n$value;

The name of the field on one line, and its value on the next.

DISPLAY First line \n Second line \n\n Fourth line;

EFX ignores the spaces around each \n, and two line breaks display an empty line.

Line breaks are new in EFX-2.

Expression block

An expression block displays the value of an EFX expression, formatted for the reader.

Syntax
${<expression>}
${<expression>|<format-option>}
$value
<expression>

any EFX expression (see Expression forms).

<format-option>

optional. How to format the value, after a vertical bar: one of the options described below.

EFX evaluates the expression with the context of the template line, once for each occurrence that the context matches. The expression can return a single value or a sequence. EFX displays all the values of a sequence.

Formatting. Without a format option, EFX formats the value according to its type:

  • A number has up to nine decimal places, with the decimal and grouping separators of the visualisation.

  • A date or a time has the short form, as with format-short.

  • The value of a field of type amount, measure or duration appears as a number, followed by the label of its unit: the currency of an amount, or the unit of a measure or of a duration. The label has the right singular or plural form for the number.

  • A duration that is calculated, such as the difference between two dates, appears as a number of months or of days, followed by the label of that unit.

  • Any other value, such as a text or a code, appears as it is.

When the block contains only a field identifier, as in ${BT-00-Number}, the type of the field decides the formatting. When it contains any other expression, as in ${BT-00-Number * 2}, the type of the result decides it. So a calculation with an amount is a number, without a unit.

Format options. A format option, after a vertical bar, chooses another formatting:

<decimals>

a digit from 0 to 9. A number, or the number of an amount, a measure or a duration, has exactly that number of decimal places. ${BT-00-Number|2} displays the same as ${format-number(BT-00-Number, '#,##0.00')}.

<decimals> no-unit

the same, without the unit of an amount, a measure or a duration.

short, medium, long

a date or a time has that form, as with format-short, format-medium and format-long.

no-unit

an amount, a measure or a duration appears as a number, formatted as without options, and without its unit.

no-formatting

the value of a field appears as it was entered in the notice, and the value of any other expression as it is, without a unit.

$value displays the value of the field declared as the context of the template line, formatted as ${<field>}. It is a short way to write an expression block that contains the field identifier. Letters that follow $value directly are text: $values displays the value followed by s.

Restrictions

  • A format option must fit the type of the value: ${BT-00-StartDate|2}, ${BT-00-Number|short} and ${BT-00-Text|2} are errors.

  • no-unit applies only to the value of an amount, a measure or a duration: ${BT-00-Text|no-unit} is an error. It cannot follow short, medium or long.

  • EFX displays a unit only with a single value. So you can display the values of a repeatable amount, measure or duration field, or a sequence of durations, only with no-unit. From ND-Root, ${BT-13-Duration} is an error, and ${BT-13-Duration|no-unit} is accepted.

  • $value requires a field as the context of the template line. With a node as context, or without context, it is an error. You cannot use it in a callable template. It takes no format option: in $value|2, the text |2 appears after the value. Write ${BT-00-Number|2} instead.

  • $value is a fragment of the template, not an expression. So you cannot use it inside an expression block, a label block or a hyperlink. Inside an expression, refer to the field by its identifier.

Examples

WITH BT-00-Number DISPLAY ${BT-00-Number * 2};

A computed value.

WITH ND-Root DISPLAY ${count(BT-00-Repeatable-Text)} texts: ${BT-00-Repeatable-Text};

A single value and a sequence. EFX displays all the texts.

WITH BT-00-StartDate DISPLAY $value (${BT-00-StartDate|long});

The date in the short form, followed by the date in the long form.

WITH BT-00-Amount DISPLAY ${BT-00-Amount} (${BT-00-Amount|0 no-unit});

The amount followed by its currency, then the amount without decimal places and without its currency.

WITH BT-00-Number DISPLAY ${BT-00-Number|no-formatting};

The number as it is written in the notice.

WITH BT-00-Code DISPLAY Code: $value, label\: #value;

The code, and its label (see Label block).

${…} and $value existed in EFX-1. The formatting by type and the format options are new in EFX-2.

Label block

A label block displays a label: a text from the translations of the SDK, in the language in which the notice is displayed. You use labels for the names of fields, for headings and for other texts that must appear in several languages.

Syntax
#{<asset-type>|<label-type>|<asset-id>}
#{<label-type>|<business-term-id>}
#{<label-type>|<field-id>}
#{<label-type>}
#{<field-id>}
#{${<label-identifier-expression>}}
#{${<label-type-expression>}|<business-term-id>}
#{${<label-type-expression>}|<field-id>}
#{${<asset-type-expression>}|<label-type>|<asset-id>}
#value

Every form between #{ and } can end with a pluraliser:

#{<asset-type>|<label-type>|<asset-id>;${<quantity>}}
<asset-type>

the kind of asset that the label describes (see the table below), or an expression block that returns it. An asset is a part of the SDK that labels describe, such as a field or a codelist.

<label-type>

the kind of label (see the table below), or an expression block that returns it. In the form #{<label-type>}, you can use only the names of the table.

<asset-id>

the identifier of the asset that the label describes. It is one of the following:

  • a business term identifier (BT-00);

  • a field identifier;

  • a name in lower case: lower-case letters, optionally followed by parts that start with - or . and contain lower-case letters and digits, such as main-activity.gen-pub;

  • an expression block that returns a text or a sequence of texts.

<business-term-id>, <field-id>

the identifier of a business term or of a field.

<label-identifier-expression>

an expression that returns a complete label identifier, as one text.

<label-type-expression>, <asset-type-expression>

an expression that returns a label type or an asset type, as one text. What an expression block written first gives depends on what follows it:

  • when nothing follows it: the whole label identifier;

  • when one identifier follows it: the label type;

  • when a label type and an asset identifier follow it: the asset type.

<quantity>

an expression that returns a single number.

Label identifiers. Each label has an identifier in three parts: <asset-type>|<label-type>|<asset-id>, for example field|name|BT-00-Text. The application that displays the notice looks up the identifier in the translations of the SDK, in the display language, and displays the text that it finds. You find the labels that exist, and their texts in each language, in the translations folder of the SDK (see Procurement labels and translations).

Asset types. You can write the following asset types directly:

Asset type Labels for

business-term

a business term (asset identifier such as BT-00)

field

a field (asset identifier: the field identifier)

node

a node

group

a display group

view

a view template

notice

a notice subtype

codelist

a codelist

code

a code of a codelist (asset identifier: <codelist>.<code>)

indicator

a value of an indicator field (asset identifier: the field identifier)

auxiliary

other texts used in view templates, such as headings

rule

a validation rule

expression

an expression used in the messages of validation rules

interval

(no labels of this asset type are defined in the SDK)

pattern

(no labels of this asset type are defined in the SDK)

You can give an asset type that is not in this table, such as business-entity, with an expression block, or in a computed label identifier.

Label types. You can write the following label types directly:

Label type Label

name

the name

description

a longer description

hint

a short help text

text

a text (for example the text of an auxiliary label or of a rule)

template

a message template (for example for validation rules)

when-true

the text for the value true of an indicator

when-false

the text for the value false of an indicator

Standard form. #{<asset-type>|<label-type>|<asset-id>} gives the three parts of the identifier. When <asset-id> is an expression block that returns a sequence of texts, EFX displays one label for each different text.

Computed label identifier. #{${<label-identifier-expression>}} computes the complete identifier, for example from a parameter of a callable template or from the value of a field.

Short forms. #{<label-type>|<business-term-id>} is the same as #{business-term|<label-type>|<business-term-id>}, and #{<label-type>|<field-id>} the same as #{field|<label-type>|<field-id>}. #{<label-type>} refers to the field or the node declared as the context of the template line. For example, #{name} in a template line with the context BT-00-Text is the same as #{field|name|BT-00-Text}.

Indirect labels. #{<field-id>} displays the label of the value of a field, instead of a label about the field.

  • For a code field, the label identifier is code|name|<codelist>.<code>. <codelist> is the codelist of the field, or, for a tailored codelist, the codelist from which it comes. <code> is the value of the field.

  • For an indicator field, the label identifier is indicator|when-true|<field-id> or indicator|when-false|<field-id>, according to the value of the field.

When the field has several values, EFX displays one label for each different value. #value displays the indirect label of the field declared as the context of the template line.

Pluraliser. A pluraliser, ;${<quantity>} before the closing brace, gives a number to the application that displays the notice. With this number, the application can choose between the singular and the plural form of the label text. You can add a pluraliser to every form written between #{ and }.

Restrictions

  • A label block contains no spaces.

  • You must give an asset type or a label type that is not in the tables above with an expression block.

  • An asset identifier written directly is a business term identifier, a field identifier or a name in lower case. You must give other identifiers with an expression block, for example #{node|name|${'ND-SubNode'}}. This applies to node identifiers, display group identifiers, rule identifiers and numbers.

  • In the short forms with a label type and an identifier, the identifier is a business term identifier or a field identifier, written directly.

  • #{<field-id>} and #value require a field of type code, internal code or indicator.

  • #{<label-type>} and #value refer to the context of the template line, so you cannot use them in a callable template. #value requires a field as context.

  • The computed label identifier, and the asset type and label type given by expression blocks, must be single texts.

  • The pluraliser must return a single number. #value has no pluraliser.

Examples

DISPLAY #{field|name|BT-00-Text};

The name of a field, in the standard form.

DISPLAY #{auxiliary|text|notice-information};

An auxiliary label, used as a heading.

WITH BT-00-Code DISPLAY #{name}: #value;

The name of the field declared as context, and the label of its code value.

WITH ND-Root DISPLAY #{name|BT-00-Text}: #{BT-00-Code};

A short form for the name of a field, and the indirect label of the value of a code field.

WITH ND-Root DISPLAY #{description|BT-00};

The description of a business term.

WITH BT-00-Text, text:$label-type = 'description' DISPLAY #{field|${$label-type}|BT-00-Text};

A label type given by an expression block.

WITH ND-Root DISPLAY #{field|name|${['BT-00-Text', 'BT-00-Number']}};

One label for each field identifier of the sequence.

DISPLAY #{${'business-entity|name|buyer'}};

A computed label identifier, for an asset type that cannot be written directly.

WITH BT-00-Number DISPLAY ${BT-00-Number} #{auxiliary|text|lot;${BT-00-Number}};

A pluraliser: the number of lots chooses between the singular and the plural form.

From the SDK (view-templates/16.efx)
			WITH BT-27-Procedure DISPLAY #{name}: ${format-number(BT-27-Procedure, '###,##0.##')} #{code|name|${concat('currency.', BT-27-Procedure/@currencyID)}} ; // Estimated value

A template line nested three levels deep in its file. An attribute of the field gives the asset identifier of the currency label.

The computed label identifier (#{${…}}), the pluraliser, and the . in asset identifiers written directly are new in EFX-2.

See also: Codelist, Indicator

A hyperlink block converts the fragment before it into a link.

Syntax
<text>@{<url>}
<label-block>@{<url>}
<expression-block>@{<url>}
<text>

template text. Only its last word becomes the link.

<label-block>

a label block, or #value (see Label block).

<expression-block>

an expression block, or $value (see Expression block).

<url>

an expression that returns a single text: the address of the link.

You write the hyperlink block directly after the fragment that it applies to: a label block, an expression block (also $value and #value), or text. For text, only the last word becomes the link. The link starts after the last space, character reference or escape sequence of the text, whichever comes last. To link several words, write them as a text literal in an expression block, for example ${'our website'}@{…}. EFX ignores spaces between the fragment and @{.

EFX evaluates the address with the context of the template line. It can be a full address, or a reference to a part of the displayed notice, such as '#notice-information'.

Restrictions

  • A hyperlink block must follow a fragment. At the start of a template or after a line break, it is an error.

  • A fragment can have only one hyperlink block.

  • You cannot use $value inside the hyperlink block. Refer to the field by its identifier.

Examples

WITH BT-00-Url DISPLAY #{name}: $value@{BT-00-Url};

EFX displays the address, as a link to itself.

WITH BT-00-Text DISPLAY See the ${'notice text'}@{concat('https://example.com/notices/', BT-00-Text)};

Two words linked to a computed address.

DISPLAY #{auxiliary|text|notice-information}@{'#notice-information'};

A label linked to a part of the displayed notice.

WITH BT-00-Url DISPLAY Visit our website @{BT-00-Url} today;

Only the word website becomes the link.

Hyperlinks are new in EFX-2.

See also: Navigation section