You are viewing the documentation for Blueriq 17. Documentation for other versions is available in our documentation directory.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 26 Current »

Learn more about the conversion functions TEXT, INTEGER, NUMBER, CURRENCY, PERCENTAGE, DATE, DATETIME, BOOLEAN. 

Convert a value of one data type into a value of another data type using conversion functions. The following conversion functions are available:

  • from string to integer, number, currency, percentage, date, dateTime or Boolean

  • from integer to string, number, currency or percentage

  • from number to string, integer, currency or percentage

  • from currency to string, integer or number

  • from percentage to string, integer or number

  • from date to string or dateTime

  • from dateTime to string or date

  • from Boolean to string, integer or number

Overview

FunctionDescription
TEXTConverts a value of another data type into a string. 
INTEGERConverts a value of another data type into an integer. 
NUMBERConverts a value of another data type into a number. 
CURRENCYConverts a value of another data type into a currency.  
PERCENTAGEConverts a value of another data type into a percentage. 
DATEConverts a value of another data type into a date. 
DATETIMEConverts a value of another data type into a datetime. 
BOOLEANConverts a value of a string into a boolean. 

Output formats in the runtime


TEXT


Converts a value of another data type into a string. 


Syntax

TEXT(integer value, [format], [locale])
TEXT(number value, [format], [locale])
TEXT(currency value, [format], [locale])
TEXT(percentage value, [format], [locale])
TEXT(date value, [format])
TEXT(dateTime value, [format])
TEXT(Boolean value, [format])


Inputs

  • value - The value of the data type that is converted to string.

  • format (optional) - The format used for conversion. Format must be enclosed by quotes, e.g. “00.00”.

  • locale (optional) - Locale specifies a combination of language and country. A locale in the option set will override the one that is used as default in the project. Commonly used are en-US, en-GB, nl-NL, nl-BE, fr-FR. The list of language codes can be found here. A list of country codes can be found here.


Default formats

For the TEXT function, the format specifies how the given datatype is converted towards a string. When no format is specified the defaults are as follows:

  • boolean to string - true;false
  • integer to string - no default format, the complete integer is set as string (no leading zeros)
  • number to string - rounded to one digit
  • percentage to string - rounded to one digit
  • currency to string - rounded to one digit
  • date to string - yyyy-MM-dd
  • datetime to string - yyyy-MM-dd hh:mm:ss

For more info on date and datetime formats, please see Date and time formats or patterns


Return type

  • string


Examples

  • TEXT(PERCENTAGE(1.2), “00.00”, “nl-NL”) results in a string value “01,20”

  • TEXT(123456.78,"#0,000","nl-NL") results in 123.457. A thousand separator has been added. The thousand separator is a point, as that is the defined one in the nl-NL locale.


Back to Top


INTEGER


Converts a value of another data type into an integer. 


Syntax

INTEGER(string value, [format], [locale])
INTEGER(number value)
INTEGER(currency value)
INTEGER(percentage value)
INTEGER(Boolean value)


Inputs

  • value - The value of the data type that is converted to integer. 

  • format (optional) - The format used for conversion. Format must be enclosed by quotes, e.g. "00.00".

  • locale (optional) - Locale specifies a combination of language and country. A locale in the option set will override the one that is used as default in the project. Commonly used are en-US, en-GB, nl-NL, nl-BE, fr-FR. The list of language codes can be found here. A list of country codes can be found here.


Default formats

For all conversion functions that use a string as parameter, the [format] describes the format in which the input string value parameter is in. When not specifying a format, by default this format is used: 

  • string to integer - no default format, the complete string is parsed to integer (leading zeros are possible and will be removed). 


Return type

  • integer


Examples

  • INTEGER(“1,0”, ”#0.0”, “nl-NL”) results in an integer value 1. 

Back to Top


NUMBER


Converts a value of another data type into a number. 


Syntax

NUMBER(string value, [format], [locale])
NUMBER(integer value)
NUMBER(currency value)
NUMBER(percentage value)
NUMBER(Boolean value)


Inputs

  • value - The value of the data type that is converted to number. 

  • format (optional) - The format used for conversion. Format must be enclosed by quotes, e.g. “00.00”.

  • locale (optional) - Locale specifies a combination of language and country. A locale in the option set will override the one that is used as default in the project. Commonly used are en-US, en-GB, nl-NL, nl-BE, fr-FR. The list of language codes can be found here. A list of country codes can be found here.


Default formats

For all conversion functions that use a string as parameter, the [format] describes the format in which the input string value parameter is in. When not specifying a format, by default this format is used: 

  • string to number - 4 digits. 


Return type

  • number


Examples

  • NUMBER(TRUE) results in a number value 1.0000

Back to Top


CURRENCY


Converts a value of another data type into a currency.  


Syntax

CURRENCY(string value, [format], [locale])
CURRENCY(integer value)
CURRENCY(number value)


Inputs

  • value - The value of the data type that is converted to currency. 

  • format (optional) - The format used for conversion. Format must be enclosed by quotes, e.g. “00.00”.

  • locale (optional) - Locale specifies a combination of language and country. A locale in the option set will override the one that is used as default in the project. Commonly used are en-US, en-GB, nl-NL, nl-BE, fr-FR. The list of language codes can be found here. A list of country codes can be found here.


Default formats

For all conversion functions that use a string as parameter, the [format] describes the format in which the input string value parameter is in. When not specifying a format, by default this format is used: 

  • currency - 2 digits. 


Return type

  • currency


Examples

  • CURRENCY(“1.2”, “invalidPattern”) results in a currency value 1.20 (an unknown pattern will be ignored)

Back to Top


PERCENTAGE


Converts a value of another data type into a percentage. 


Syntax

PERCENTAGE(string, [format], [locale])
PERCENTAGE(integer)
PERCENTAGE(number)


Inputs

  • value - The value of the data type that is converted to percentage. 

  • format (optional) - The format used for conversion. Format must be enclosed by quotes, e.g. “00.00”.

  • locale (optional) - Locale specifies a combination of language and country. A locale in the option set will override the one that is used as default in the project. Commonly used are en-US, en-GB, nl-NL, nl-BE, fr-FR. The list of language codes can be found here. A list of country codes can be found here.


Default formats

For all conversion functions that use a string as parameter, the [format] describes the format in which the input string value parameter is in. When not specifying a format, by default this format is used: 

  • string to percentage - 2 digits. 


Return type

  • percentage


Examples

  • PERCENTAGE ("22") results in a percentage value of 22,00 (default format is used). 

Back to Top


DATE


Converts a value of another data type into a date. 


Syntax

DATE(string value, format)
DATE(dateTime value)


Inputs

  • value - The string of dateTime value to be converted to a date type. 

  • format (optional) - The format used for conversion. Format must be enclosed by quotes, e.g. "yyyy-MM-dd". For more info on specifying date format patterns, please see Date and time formats or patterns


Default formats

When the format is omitted the ISO-8601 date format yyyy-MM-dd (Most to least significant principle) is used for converting the value to a date. 
However we advice to use an explicit date format in your conversion function to avoid any confusion about the format used for conversion.


Return type

  • date

Examples string to date conversion

  • DATE("2024-07-22", "yyyy-MM-dd") converts the string value "2024-07-22" into a value of type date.
  • DATE("22/07/2024", "dd/MM/yyyy") converts the string value "22/07/2024" into a value of type date.

Example dateTime to date conversion

  • Assume we have a dateTime attribute Person.TimeOfBirth
    DATE(Person.TimeOfBirth) will return the date part of this attribute.

Note

The way in which dates are displayed in the UI is determined by the date display formats, which can be configured per language code. For example the Dutch nl-NL date format could be configured as "dd-MM-yyyy", whereas the English en-US date format can be defined as "MM/dd/yyyy".
The converted date in our example could look like "22-07-2024" when displayed in Dutch (nl-NL) and like "07/22/2024" when displayed in English (en-US).
More information about language specific formats can be found in Reference Guide: Language formats.

Back to Top


DATETIME


Converts a value of another data type into a datetime. 


Syntax

DATETIME(string value, [format])
DATETIME(date value)


Inputs

  • value - The value of the data type that is converted to datetime. 

  • format (optional) - The format used for conversion. Format must be enclosed by quotes, e.g. “yyyy-MM-dd hh:mm:ss”. For more info on specifying datetime format patterns, please see Date and time formats or patterns


Default formats

When the format is omitted the ISO-8601 date time format yyyy-MM-dd hh:mm:ss (Most to least significant principle) is used for converting the value to a datetime. 
However we advice to use an explicit datetime format in your conversion function to avoid any confusion about the format used for conversion.


Return type

  • date


String to datetime examples

  • DATETIME("22-07-2024 16:38:40", "dd-MM-yyyy hh:mm:ss) converts the string "22-07-2024 16:38:40" in a datetime value.
  • DATETIME("20240722 16.38.40", "yyyyMMdd hh.mm.ss") converts the string "20240722 16.38.40" in a datetime value. 

Date to datetime example

  • Assume we have a date attribute Person.DateOfBirth
    DATETIME(Person.DateOfBirth) converts the date value to a datetime value by extending the date value with the timestamp 00:00:00.

Note

The way in which date and time values are displayed in the UI is determined by the date and time display formats, which can be configured per language code. For example the Dutch nl-NL date format could be configured as "dd-MM-yyyy hh:mm:ss", whereas the English en-US date format can be defined as "MM/dd/yyyy hh.mm.ss".
The converted date time in our example could look like "22-07-2024 16:38:40" when displayed in Dutch (nl-NL) and like "07/22/2024 16.38.40" when displayed in English (en-US).
More information about language specific formats can be found in Reference Guide: Language formats.


38:40Back to Top



BOOLEAN


Converts a value of a string into a boolean. 


Syntax

BOOLEAN(string, [format])


Inputs

  • string - The string value that is converted to boolean. 

  • format (optional) - The format used for conversion. Format must be enclosed by quotes, e.g. ”1;0”. 


Default formats

For all conversion functions that use a string as parameter, the [format] describes the format in which the input string value parameter is in. When not specifying a format, by default this format is used: 

  • string to boolean - true;false. 


Return type

  • boolean


Examples

  • BOOLEAN(“1”,”1;0”) results in a boolean value TRUE.  

Back to Top


Output formats in the runtime


Please see the Reference Guide: Language Formats to change how the runtime displays attributes. 

  • No labels