You are viewing the documentation for Blueriq 17. Documentation for other versions is available in our documentation directory.
Format
Formats are used in resources. When you connect to external data, these data records are converted to a valid format in Blueriq Encore. If the default conversion does not convert the imported data to the format you want, you can specify a custom conversion format.
There are three different types of format conversions:
1. Number conversion
A number format pattern can be divided into four parts.
Syntax:
{options}format;negative-spec;positive-spec
options - Valid option: {locale=locale} Locale specifies a combination of language and country. The option set is optional and must be surrounded with { } when used. It represents a key value mechanism with ',' as separator sign. The set {a=b,q=e} represents a situation in which a is set to b and q is set to e. A locale in the option set will override the one that is used as default in the project.
format - The format pattern consists of a decimal part and a fractional part, separated by a '.' if a fractional part is required. Note that the locale setting determines whether the fractional separator is a ',' or a '.'.
The decimal part specifies grouping, the minimum and the maximum number of digits.
The fractional part begins after the decimal separator. If there is no decimal separator, there is no fractional part. The fractional part specifies the minimum and maximum of fraction digits.
negative-spec - This pattern specifies the parsing of negative numbers, '#' represents the specified format pattern. For example, ”(#);0.0” specifies that a negative number is prefixed with '(' and postfixed with ')'.
positive-spec - This pattern specifies the parsing of positive numbers, '#' represents the specified format pattern. For example, “0.0;+#” specifies that a positive number is prefixed with '+'.
Examples:
Format | Description |
---|---|
#0 | This format parses positive integers and will not use or accept fractional digits. Negative numbers will not parse. |
#0.00 | This format parses positive numbers with two fractional digits. The decimal separator is determined by the default locale in the project. Examples for locale en-US: “0.00”, “12469333.88”; for locale nl-NL: “0,00”, “78555555,33”. |
000.00 | This format parses “000.00” to “000.99”. “0.00” will not parse. The decimal separator is determined by the default locale in the project. |
#,##0.00 | This format parses positive numbers with thousand separator. The decimal separator is determined by the default locale in the project. Examples for locale en-US: “1,000,000.33”, “30.44”; for locale nl-NL: “1.000.000,33”, “30,44”. |
#0.00;-# | This format parses negative numbers with leading '-' and positive numbers without leading '+'. A fraction of two digits is mandatory. The decimal separator is determined by the default locale of the project. |
#0.00;-#;+# | This format parses negative numbers with leading '-' and positive numbers with leading '+'. A fraction of two digits is mandatory. The decimal separator is determined by the default locale of the project. |
{locale=nl-NL}000.00;-#;+# | This format parses ”-999,99” up to ”+999,99”. The decimal separator is ',' in the locale NL-nl. Leading '-' and '+' are required. |
2. Date conversion
This format parses dates that use numbers to indicate months. Times cannot be parsed.
Syntax:
date-format
date-format - The following characters can be used to make up the format string:
yyyy - represents the four digit year
MM - represents the month in one or two digits
dd - represents the day of the month in one or two digits
'-', '/', ' ' - can be used to separate the date components
Examples:
“yyyyMMdd” parses “20100305” as March 5, 2010.
“dd MM yyyy” parses “31 01 2012” as January 31, 2012.
“dd-MM-yyyy” parses “09-10-1990” as October 9, 1990.
“MM/dd/yyyy” parses “09/10/1990” as September 10, 1990.
3. Boolean conversion
This format parses string representations into booleans. A boolean pattern can be divided into two parts.
Syntax:
true-spec;false-spec
true-spec - A true-spec is a comma separated list of values representing TRUE.
false-spec - A false-spec is a comma separated list of values representing FALSE.
Examples:
“true;false” will convert a boolean value TRUE to value 'true' and a boolean value FALSE to value 'false'. The complete syntax is: TEXT(TRUE,"yes;no").
“true,yes,ok,oui,si,1;false,no,cancel,non,no,0” will create a boolean value TRUE for values 'true', 'yes', 'ok', 'oui', 'si' and '1' and a boolean value FALSE for values 'false', 'no', 'cancel', 'non', 'no' and '0'.
Note that true-spec
and false-spec
can not have the same value, as the values should still be convertible in a later stadium. The following expression TEXT(TRUE,"1;1") is invalid.