Type conversions
EFX never converts a value from one data type to another by itself. You always write a conversion yourself, with a conversion function (see Type conversion).
Conversion functions
| From | To | Function | Result |
|---|---|---|---|
number |
text |
the number in standard decimal form |
|
indicator |
text |
|
|
date |
text |
the date as year-month-day with its time zone |
|
time |
text |
the time as hours:minutes:seconds with its time zone |
|
duration |
text |
the duration in ISO 8601 form, for example |
|
text |
number |
the number written in the text, or NaN ("not a number") when the text is not a number |
|
indicator |
number |
|
|
number |
indicator |
|
|
text |
date |
the date written in the text |
|
text |
time |
the time written in the text |
|
text |
duration (days, hours, minutes, seconds) |
for example from |
|
text |
duration (months, years) |
for example from |
There is no conversion from text to indicator, from date to number or from number to date.
Operators and functions whose result has another type
The following operators and functions are not conversions, but the type of their result differs from the type of their operands.
| From | To | Operator or function |
|---|---|---|
date and date |
duration |
|
date and duration |
date |
|
number and duration |
duration |
|
text |
number |
|
date |
number |
|
time |
number |
|
duration |
number |
|
sequence, or node |
number |
|
sequence of texts |
text |
|
text |
sequence of texts |
|
number |
text (templates only) |
|
date or time |
text (templates only) |
|
text-multilingual field |
text (templates only) |
the property |
any field |
text |
the property |
Correspondences without a function
-
Each type of field defined in the SDK matches an EFX data type, and a field reference gives values of that type (see Field types and their EFX data types).
-
A text-multilingual field gives texts, one for each language.
-
EFX accepts any single value where a sequence is expected: it stands for a sequence of one value. The other way round is not true: EFX never accepts a sequence where a single value is required.
-
A context variable that holds a field stands for the value of that field when you use it as a value.
See also: Type conversion, Data types, Conversion functions