Syntax summary
Every construct of EFX and every built-in function, in the order of this reference, with the syntax given in its entry. The name of each construct links to its entry, which explains the parts of the syntax. The notation is explained in Syntax notation.
EFX Expressions
- Single expression
-
WITH <context> COMPUTE <expression> WITH <context>, <parameter-declaration>, … COMPUTE <expression>
- Selector
-
WITH <context> SELECT <selection> WITH <context>, <parameter-declaration>, … SELECT <selection>
- Parameters of a single expression
-
<type>:$<name> <type>*:$<name>
- Text literal
-
'<characters>' "<characters>" {<uuid>} - Number literal
-
<digits> <digits>.<digits> .<digits> -<number-literal>
- Indicator literal
-
TRUE FALSE ALWAYS NEVER
- Date literal
-
<year>-<month>-<day>Z <year>-<month>-<day>+<hours>:<minutes> <year>-<month>-<day>-<hours>:<minutes>
- Time literal
-
<hours>:<minutes>:<seconds>Z <hours>:<minutes>:<seconds>+<zone-hours>:<zone-minutes> <hours>:<minutes>:<seconds>-<zone-hours>:<zone-minutes>
- Duration literal
-
P<number>D P<number>W P<number>M P<number>Y -P<number>D -P<number>W -P<number>M -P<number>Y
- Sequence literal
-
[<literal>, <literal>, …]
- Field reference
-
<field-identifier> <field-identifier>[<condition>] <field-identifier>[at <position>]
- Node reference
-
<node-identifier> <node-identifier>[<condition>] <node-identifier>[at <position>]
- Attribute reference
-
<field-reference>/@<attribute-name>
- Absolute reference
-
/<field-identifier> /<field-identifier>[<condition>] /<node-identifier> /<node-identifier>[<condition>]
- Predicate
-
<field-reference>[<condition>] <node-reference>[<condition>]
- Context override (
::) -
$<variable-name>::<field-reference> $<variable-name>::<node-reference>
- Field property
-
<field>:<property>
- Linked field property
-
<field-identifier>:publicationDate <field-identifier>:justificationCode <field-identifier>:justificationDescription <field-identifier>:<linked-property>[<condition>]
- Privacy property
-
<field-identifier>:privacyCode <field-identifier>:isWithholdable <field-identifier>:wasWithheld <field-identifier>:isWithheld <field-identifier>:isDisclosed <field-identifier>:isMasked
- Preferred language property
-
<field-reference>:preferredLanguage <field-reference>:preferredLanguageText
- Raw value
-
<field-reference>:rawValue
- Codelist reference
-
[...<codelist-identifier>]
- Variable reference
-
$<variable-name>
- Variable declaration
-
LET <type>:$<variable-name> = <expression>; LET <type>*:$<variable-name> = <sequence-expression>; <type>:$<variable-name> = <expression> <type>*:$<variable-name> = <sequence-expression>
- Context variable
-
WITH context:$<variable-name> = <node-context> WITH context:$<variable-name> = <field-context> WITH <variable-list>, context:$<variable-name> = <node-context>, <variable-list>
- Dynamic variable
-
LET dynamic:$<variable-name> = ?<function-name>(<argument>, <argument>, …); dynamic:$<variable-name> = ?<function-name>(<argument>, <argument>, …)
- Iterator variable
-
<type>:$<variable-name> in <sequence> context:$<variable-name> in <node-context> context:$<variable-name> in <field-context>
- Arithmetic operators
-
<number> + <number> <number> - <number> <number> * <number> <number> / <number> <number> % <number>
- Date and duration arithmetic
-
<date> - <date> <date> + <duration> <duration> + <date> <date> - <duration> <duration> + <duration> <duration> - <duration> <number> * <duration> <duration> * <number>
- Comparison operators
-
<value> == <value> <value> != <value> <value> < <value> <value> <= <value> <value> > <value> <value> >= <value>
- Logical operators
-
<condition> and <condition> <condition> or <condition>
- Membership (
in,not in) -
<value> in <sequence> <value> not in <sequence>
- Pattern matching (
like) -
<text> like <pattern> <text> not like <pattern>
- Presence (
is present) -
<reference> is present <reference> is not present
- Emptiness (
is empty) -
<sequence> is empty <sequence> is not empty
- Uniqueness (
is unique in) -
<value> is unique in <sequence> <value> is not unique in <sequence>
- Duplicates (
has duplicates,has no duplicates) -
<sequence> has duplicates <sequence> has no duplicates
- Parentheses and precedence
-
( <expression> )
- Conditional expression
-
if <condition> then <value-if-true> else <value-if-false>
- Sequence construction
-
[<value>] [<value>, <value>, …] <field-reference> <codelist-reference> <variable-reference> <iteration> <function-call> ( <sequence> )
- Index
-
<sequence>[at <position>]
- Iteration
-
for <iterator> return <expression> for <iterator> return distinct <expression> for <iterator>, <iterator>, … return <expression> for <iterator>, <iterator>, … return distinct <expression>
- Quantified expression
-
every <iterator> satisfies <condition> some <iterator> satisfies <condition> every <iterator>, <iterator>, … satisfies <condition> some <iterator>, <iterator>, … satisfies <condition>
- Built-in function call
-
<function-name>() <function-name>(<argument>) <function-name>(<argument>, <argument>, …)
- User-defined function call
-
?<function-name>() ?<function-name>(<argument>) ?<function-name>(<argument>, <argument>, …)
- Dynamic function call
-
?<function-name>() ?<function-name>(<argument>) ?<function-name>(<argument>, <argument>, …)
EFX Templates
- Template file
-
<global-declaration> … --- TEMPLATE <template-name> --- … --- MAIN --- <template-line> … --- HEADER --- <header-line> … --- SUMMARY --- <template-line> … --- NAVIGATION --- <template-line> …
- Include directive
-
#include "<path>" #include "<path>";
- Comments and blank lines in templates
-
// <comment>
- Global variable
-
LET <type>:$<variable-name> = <expression>;
- Dictionary declaration
-
LET $<dictionary-name> INDEX <field> BY <key>;
- Dictionary lookup
-
$<dictionary-name>[<key>]
- User-defined function declaration
-
LET <return-type>:?<function-name>(<parameter>, <parameter>, …) = <expression>; LET <return-type>:?<function-name>() = <expression>;
- Template line
-
WITH <context-declaration> DISPLAY <template>; WITH <context-declaration> <conditional-display>; DISPLAY <template>; <conditional-display>; WITH <context-declaration> <template-invocation>; <template-invocation>;
- Indentation
-
<template-line> <indent><template-line> <indent><indent><template-line>
- Heading
-
<indentation><number> <rest-of-template-line> <indentation>? <rest-of-template-line> <indentation># <rest-of-template-line> <indentation>#<tag> <rest-of-template-line>
- Bulleted line
-
<indentation>* <rest-of-template-line>
- Context declaration
-
WITH <context> WITH <context>, <variable-initialiser>, <variable-initialiser>, … WITH <variable-initialiser>, <variable-initialiser>, …, <context> WITH <variable-initialiser>, …, <context>, <variable-initialiser>, …
DISPLAY-
DISPLAY <template>
- Caption
-
DISPLAY <caption>: <content>
- Conditional display
-
WHEN <condition> DISPLAY <template> … OTHERWISE DISPLAY <template> WHEN <condition> DISPLAY <template> … OTHERWISE <template> WHEN <condition> INVOKE <template-name>(<argument>, …) … OTHERWISE INVOKE <template-name>(<argument>, …)
- Template invocation
-
INVOKE <template-name>(<argument>, <argument>, …) INVOKE <template-name>() WHEN <condition> INVOKE <template-name>(<argument>, …) … OTHERWISE INVOKE <template-name>(<argument>, …)
- Line terminator and line joining
-
<template-line>; <text> \ <continued-text>
- Text
-
<characters>
- Escape sequences and character references
-
&<entity-name>; &#<decimal-number>; &#x<hexadecimal-number>; \<character>
- Line break
-
<fragment>\n<fragment>
- Expression block
-
${<expression>} ${<expression>|<format-option>} $value - Label block
-
#{<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 - Hyperlink
-
<text>@{<url>} <label-block>@{<url>} <expression-block>@{<url>} - Template section
-
--- TEMPLATE <template-name> --- LET <parameter>, <parameter>, …; <template-line> …
- Main section
-
--- MAIN --- <template-line> …
- Header section
-
--- HEADER --- #HEADING <heading-display>; #SUBHEADING <heading-display>; #TITLE <normal-display>; #COUNTRY <normal-display>; #MAIN-CLASSIFICATION <normal-display>; #MAIN-NATURE <normal-display>; #FORM-TYPE <normal-display>; #NOTICE-TYPE <normal-display>; #PUBLICATION-NUMBER <normal-display>; #OJ-ISSUE <normal-display>; #PUBLICATION-DATE <normal-display>; <normal-line> …
- Summary section
-
--- SUMMARY --- <template-line> …
- Navigation section
-
--- NAVIGATION --- <template-line> …
EFX Rules
- Rules file
-
<include-directive> … <api-endpoint-declaration> … <global-declaration> … <validation-stage> …
- Include directive
-
#include "<path>" #include "<path>";
- API endpoint declaration
-
ENDPOINT "<endpoint-name>"; ENDPOINT "<endpoint-name>" AT "<url>";
- Dynamic function declaration
-
LET dynamic:?<function-name>(<parameters>) CALL API; LET dynamic:?<function-name>(<parameters>) CALL API "<endpoint-name>"; LET dynamic:?<function-name>(<parameters>) CALL API "<endpoint-name>" ON ERROR WARN "<label-identifier>"; LET dynamic:?<function-name>(<parameters>) CALL API "<endpoint-name>" ON ERROR REJECT "<label-identifier>";
- Global variable
-
LET <type>:$<variable-name> = <expression>; LET dynamic:$<variable-name> = ?<function-name>(<arguments>);
- Validation stage
-
---- STAGE <stage-identifier> ---- <stage-variable> … <rule-set> …
- Stage variable
-
LET <type>:$<variable-name> = <expression>; LET dynamic:$<variable-name> = ?<function-name>(<arguments>);
- Rule-set
-
<with-clause> <rule> … <with-clause> <conditional-rule> … <fallback-rule>
WITHclause-
WITH <context> WITH <variable>, …, <context> WITH <context>, <variable>, … WITH <variable>, …, <context>, <variable>, … WITH EVERY <context> WITH EVERY <variable>, …, <context>, <variable>, …
- Rule
-
<test> AS <severity> <rule-identifier> FOR <target> IN <notice-subtypes>; <test> AS <severity> <rule-identifier> FOR <target> IN <notice-subtypes> SCOPE <scope>;
WHENclause-
WHEN <precondition> ASSERT <condition> <other-clauses> WHEN <precondition> REPORT <condition> <other-clauses>
ASSERTclause-
ASSERT <condition> ASSERT <semantic-assertion>
- Semantic assertion
-
ASSERT IS NOT EMPTY ASSERT IS NOT PRESENT ASSERT NOT REPEATED ASSERT NOT MODIFIED VIA <condition> ASSERT NOT ADDED VIA <condition> ASSERT NOT REMOVED VIA <condition> ASSERT OCCURS <comparison-operator> <integer> ASSERT OCCURS BETWEEN <integer> AND <integer> ASSERT LENGTH <comparison-operator> <integer> ASSERT LENGTH BETWEEN <integer> AND <integer> ASSERT VALUE <comparison-operator> <number> ASSERT VALUE BETWEEN <number> AND <number> ASSERT IN [...<codelist-identifier>] ASSERT LIKE '<pattern>'
REPORTclause-
REPORT <condition>
OTHERWISEclause-
OTHERWISE ASSERT <condition> <other-clauses> OTHERWISE ASSERT <semantic-assertion> <other-clauses> OTHERWISE REPORT <condition> <other-clauses>
ASclause-
AS ERROR <rule-identifier> AS WARNING <rule-identifier> AS INFO <rule-identifier>
FORclause-
FOR <field-identifier> FOR <node-identifier>
INclause-
IN * IN ANY IN <notice-subtypes>, <notice-subtypes>, …
SCOPEclause-
SCOPE @PRE SCOPE @POST SCOPE #<flag> SCOPE @PRE #<flag> SCOPE @POST #<flag> SCOPE #<flag> @PRE SCOPE #<flag> @POST
Built-in functions
- text
-
text(<number>) → text text(<indicator>) → text text(<date>) → text text(<time>) → text text(<duration>) → text
- number
-
number(<text>) → number number(<indicator>) → number
- indicator
-
indicator(<number>) → indicator
- date
-
date(<text>) → date
- time
-
time(<text>) → time
- day-time-duration
-
day-time-duration(<text>) → duration
- year-month-duration
-
year-month-duration(<text>) → duration
- string-length
-
string-length(<text>) → number
- index-of-substring
-
index-of-substring(<text>, <substring>) → number
- substring
-
substring(<text>, <start>) → text substring(<text>, <start>, <length>) → text
- substring-before
-
substring-before(<text>, <delimiter>) → text
- substring-after
-
substring-after(<text>, <delimiter>) → text
- concat
-
concat(<text>) → text concat(<text>, <text>, …) → text
- string-join
-
string-join(<sequence>, <separator>) → text
- repeat
-
repeat(<text>, <count>) → text
- upper-case
-
upper-case(<text>) → text
- lower-case
-
lower-case(<text>) → text
- capitalize-first
-
capitalize-first(<text>) → text
- normalize-space
-
normalize-space(<text>) → text
- trim
-
trim(<text>) → text
- trim-left
-
trim-left(<text>) → text
- trim-right
-
trim-right(<text>) → text
- pad-left
-
pad-left(<text>, <length>, <padding>) → text
- pad-right
-
pad-right(<text>, <length>, <padding>) → text
- replace
-
replace(<text>, <search>, <replacement>) → text
- replace-regex
-
replace-regex(<text>, <pattern>, <replacement>) → text
- url-encode
-
url-encode(<text>) → text
- absolute
-
absolute(<number>) → number
- round
-
round(<number>) → number
- round-down
-
round-down(<number>) → number
- round-up
-
round-up(<number>) → number
- sum
-
sum(<sequence>) → number
- min
-
min(<sequence>) → number
- max
-
max(<sequence>) → number
- average
-
average(<sequence>) → number
- not
-
not(<condition>) → indicator
- contains
-
contains(<text>, <substring>) → indicator
- starts-with
-
starts-with(<text>, <prefix>) → indicator
- ends-with
-
ends-with(<text>, <suffix>) → indicator
- empty
-
empty(<text>) → indicator
- sequence-equal
-
sequence-equal(<sequence-1>, <sequence-2>) → indicator
- current-date
-
current-date() → date
- current-time
-
current-time() → time
- add-duration
-
add-duration(<date>, <duration>) → date
- subtract-duration
-
subtract-duration(<date>, <duration>) → date
- year
-
year(<date>) → number
- month
-
month(<date>) → number
- day
-
day(<date>) → number
- hours
-
hours(<time>) → number
- minutes
-
minutes(<time>) → number
- seconds
-
seconds(<time>) → number
- years
-
years(<duration>) → number
- months
-
months(<duration>) → number
- days
-
days(<duration>) → number
- count
-
count(<sequence>) → number count(<node-reference>) → number
- count-duplicates
-
count-duplicates(<sequence>) → number
- distinct-values
-
distinct-values(<sequence>) → sequence
- get-duplicates
-
get-duplicates(<sequence>) → sequence
- value-union
-
value-union(<sequence-1>, <sequence-2>) → sequence
- value-intersect
-
value-intersect(<sequence-1>, <sequence-2>) → sequence
- value-except
-
value-except(<sequence-1>, <sequence-2>) → sequence
- sort
-
sort(<sequence>) → sequence
- reverse
-
reverse(<sequence>) → sequence
- subsequence
-
subsequence(<sequence>, <start>) → sequence subsequence(<sequence>, <start>, <length>) → sequence
- index-of
-
index-of(<sequence>, <value>) → number
- split
-
split(<text>, <delimiter>) → text*
- format-number
-
format-number(<number>, <picture>) → text
- format-short
-
format-short(<date>) → text format-short(<time>) → text format-short(<date>, <time>) → text
- format-medium
-
format-medium(<date>) → text format-medium(<time>) → text format-medium(<date>, <time>) → text
- format-long
-
format-long(<date>) → text format-long(<time>) → text format-long(<date>, <time>) → text
- preferred-language
-
preferred-language(<field>) → text
- preferred-language-text
-
preferred-language-text(<field>) → text