Indicator functions

Indicator functions return an indicator, TRUE or FALSE. They negate a condition (not), test a text (contains, starts-with, ends-with, empty) or compare two sequences (sequence-equal).

You write many tests with operators rather than functions. See Logical operators, Comparison operators, Membership (in, not in), Pattern matching (like), Presence (is present) and Emptiness (is empty). The function indicator, which converts a number to an indicator, has its entry with the conversion functions.

not

Negates an indicator.

Syntax
not(<condition>) → indicator
<condition>

indicator. The condition to negate.

The result is TRUE when <condition> is FALSE, and FALSE when <condition> is TRUE.

Several operators have a negative form, which you can write instead of a call to not: not in, not like, is not present, is not empty, is not unique in and has no duplicates.

Restrictions

  • The argument must be an indicator. A text or a number as argument is an error.

Examples

not(BT-00-Number > 100)
not(contains(BT-00-Text, 'test'))
not(BT-00-StartDate < BT-00-EndDate and BT-00-Number > 0)

See also: Logical operators

contains

Tests whether a text contains another text.

Syntax
contains(<text>, <substring>) → indicator
<text>

text. The text to search in.

<substring>

text. The text to search for.

The result is TRUE when <substring> occurs anywhere in <text>. The comparison is exact: upper-case and lower-case letters are different. Every text contains the empty text, so the result is TRUE when <substring> is empty. A text without value counts as an empty text.

Examples

contains(BT-00-Text, 'framework')
contains(lower-case(BT-00-Text), 'framework')

Ignores the case of the letters.

starts-with

Tests whether a text begins with another text.

Syntax
starts-with(<text>, <prefix>) → indicator
<text>

text. The text to test.

<prefix>

text. The text expected at the start.

The result is TRUE when <text> begins with <prefix>. The comparison is exact: upper-case and lower-case letters are different. An empty <prefix> gives TRUE. A text without value counts as an empty text.

Examples

starts-with(BT-00-Identifier, 'ORG-')
starts-with(BT-00-Url, 'https://')

See also: ends-with, contains

ends-with

Tests whether a text ends with another text.

Syntax
ends-with(<text>, <suffix>) → indicator
<text>

text. The text to test.

<suffix>

text. The text expected at the end.

The result is TRUE when <text> ends with <suffix>. The comparison is exact: upper-case and lower-case letters are different. An empty <suffix> gives TRUE. A text without value counts as an empty text.

Examples

ends-with(BT-00-Email, '.eu')
ends-with(lower-case(BT-00-Url), '.pdf')

See also: starts-with, contains

empty

Tests whether a text has no characters.

Syntax
empty(<text>) → indicator
<text>

text. The text to test.

The result is TRUE when <text> is an empty text. EFX reads the values of text fields without the white space at their start and end. So a text field that holds only white space is empty.

A text that has no value at all, for example a field that is not present in the notice, is not an empty text, so the result is FALSE. To test whether a field is present, use is present. To test whether a sequence has no values, use is empty.

Examples

empty(BT-00-Text)

TRUE when the field is in the notice but holds no text.

BT-00-Text is not present or empty(BT-00-Text)

TRUE when the field is missing or holds no text.

empty(concat(BT-00-Text, BT-12-Text))

TRUE when neither field holds any text, whether the fields are present or not.

New in EFX-2.

sequence-equal

Tests whether two sequences contain the same values, in any order.

Syntax
sequence-equal(<sequence-1>, <sequence-2>) → indicator
<sequence-1>

sequence of text, number, indicator, date, time or duration values.

<sequence-2>

sequence of values of the same type as <sequence-1>.

The result is TRUE when both sequences contain the same values, each the same number of times. The order of the values does not matter: ['a', 'b'] and ['b', 'a'] are equal. Duplicates matter: ['a', 'b', 'b'] and ['a', 'b'] are not equal. Two empty sequences are equal.

EFX compares texts exactly, and numbers by value, so 2 and 2.0 are equal.

Restrictions

  • Both sequences must have the same type. A comparison of a sequence of texts with a sequence of numbers is an error.

  • A sequence of durations cannot mix durations in years and months with durations in days. Such a sequence causes an error when the expression is evaluated.

Examples

sequence-equal(BT-13-Text, BT-14-Text)

TRUE when the two repeatable fields hold the same values.

sequence-equal(distinct-values(BT-13-Text), ['a', 'b'])

TRUE when the field holds the values a and b, possibly several times each, and no other value.

In EFX-2, both sequences must have the same type.