Table of Contents

Search

  1. Preface
  2. Taskflows and linear taskflows
  3. Taskflows
  4. Linear taskflows

Taskflows

Taskflows

toChar (Numbers)

toChar (Numbers)

Converts numeric values to text strings.

Syntax

sff:toChar(xs:double(val))
After you add the function, you must manually add the phrase (xs:double) in the syntax. Otherwise, the taskflow fails.
The following table describes the arguments:
Argument
Required/ Optional
Description
val
Required
The numeric value that you want to convert to a string. You can enter any valid transformation expression.
toChar converts double values to text strings as follows:
  • Converts double values of up to 16 digits to strings and provides accuracy up to 15 digits. If you pass a number with more than 15 digits, toChar rounds the number based on the sixteenth digit and returns the string representation of the number in scientific notation. For example, 1234567890123456 double value converts to '1.23456789012346e+015' string value.
  • Returns decimal notation for numbers in the ranges (-1e16,-1e-16] and [1e-16, 1e16). toChar returns scientific notation for numbers outside these ranges. For example, 10842764968208837340 double value converts to '1.08427649682088e+019' string value.
toChar converts decimal values to text strings as follows:
  • In low precision mode, toChar treats decimal values as double values.
  • If you pass a decimal port to the toChar function and the input value does not have enough digits to match the scale of the decimal port, the toChar function appends zeros to the value.
    For example, if the scale of the decimal port is 5 and the value in a row is 7.6901, the toChar function treats the input value as 7.69010 and the return value is '7.69010.'

Return Value

String.
NULL if a value passed to the function is NULL.

Double Conversion Example

The following expression converts the double values in the SALES port to strings:
sff:toChar(xs:double(SALES))
SALES
RETURN VALUE
1010.99
'1010.99'
-15.62567
'-15.62567'
10842764968208837340
'1.08427649682088e+019'
  (rounded based on the 16th digit and returns the value in scientific notation)
236789034569723
'236789034569723'
0
'0'
33.15
'33.15'
NULL
NULL

Decimal Conversion Example

The following expression converts the decimal values in the SALES port to strings in high precision mode:
sff:toChar(xs:double(SALES))
The following table lists some sample values and return values when the precision is greater than 38:
SALES
RETURN VALUE
2378964536789761
'2378964536789761'
1234567890123456789012345679
'1234567890123456789012345679'
1.234578945469649345876123456
'1.234578945469649345876123456'
0.999999999999999999999999999
'0.999999999999999999999999999'
12345678901234567890123456799
'12345678901234567890123456799'
23456788992233456678458934567123465239
'23456788992233456678458934567123465239'
423456789012345678901234567991234567899
(greater than 38)
'4.23456789012346e+038'
The following table lists some sample values and return values when the precision is greater than 28:
SALES
RETURN VALUE
2378964536789761
'2378964536789761'
1234567890123456789012345679
'1234567890123456789012345679'
1.234578945469649345876123456
'1.234578945469649345876123456'
0.999999999999999999999999999
'0.999999999999999999999999999'
12345678901234567890123456799
(greater than 28)
'1.23456789012346e+028'
The toChar (Dates) function converts a Date/Time datatype to a string with the format you specify. You can convert the entire date or a part of the date to a string.
Use double quotation marks to separate ambiguous format strings, for example D"D""DDD. The empty quotation marks do not appear in the output.

0 COMMENTS

We’d like to hear from you!