Type conversion functions

Use the type conversion functions to change the type of an argument.

The following functions are in the Type Conversion category of the expression editor. Square brackets indicate an argument is optional. The default date format is %yyyy-%mm-%dd.

The examples show the function as it appears in a Derivation field in the Transformer stage.

Conversion

Converts a string to a specified internal or external storage format. The string expression evaluates the string to be converted.

The following list shows the values that you can specify for the conversion. The conv_code specifies types of storage formats involved in the conversion, and conv_mode specifies which format is used for input or output. If you specify "I" for conv_mode, the ICONV() function is used for the conversion. If you specify "O" for conv_mode, the OCONV() function is used for the conversion.
Table 1. Supported conversion codes
D Date conversion
G Group extraction
L Length function
MB Binary conversion
MCA Masked alphabetic conversion
MC/A Masked nonalphabetic conversion
MCD Decimal to hexadecimal conversion
MCDX Decimal to hexadecimal conversion
MCL Masked lowercase conversion
MCM Masked multibyte conversion
MC/M Masked single-byte conversion
MCN Masked numeric conversion
MC/N Masked nonnumeric conversion
MCP Masked unprintable character conversion
MCT Masked initial capitals conversion
MCU Masked uppercase conversion
MCW Masked wide-character conversion
MCX Hexadecimal to decimal conversion
MCXD Hexadecimal to decimal conversion
MD Masked decimal conversion
ML Masked left conversion
MR Masked right conversion
MT Time conversion
MU0C Hexadecimal Unicode character conversion
MX Hexadecimal conversion
MY ASCII conversion
  • Input: string (string), conv_code (string), conv_mode (string)
  • Output: result (string)
  • Examples. If mylink.mystring contains the string "CDE", then the following function returns the value 434445.
    Conversion(mylink.mystring,"MB", "I")
    
    Examples. If mylink.mystring contains the string "1111", then the following function returns the value 15.
    Conversion(mylink.mystring,"MB", "I")
    
Char
Generates an ASCII character from its numeric code value. You can optionally specify the allow8bits argument to convert 8-bit ASCII values.
  • Input: code (number), [allow8bits]
  • Output: result (char)
  • Examples. The following example outputs the ASCII code 65 as the character A.
    Char(65)
    
Base64ToString
Decodes a string by using base 64 decoding.
  • Input: source string (string)
  • Output: result (string)
  • Examples. If mylink.mystring1 contains a base 64 encoded string, then the following function returns the base 64 decoded string.
    Base64ToString(mylink.mystring1)
DateToString
Returns the string representation of the given date. The format of the string can optionally be specified.
  • Input: date (date), [format (string)]
  • Output: result (string)
  • Examples. The following example outputs the date contained in the column mylink.mydate to a string. If mylink.mydate contains the date 18th August, 2009, then the output string is "2009-08-18":
    DateToString(mylink.mydate)
    
    The following example outputs the date contained in the column mylink.mydate to a string with the format dd:mm:yyyy. If mylink.mydate contained the date 18th August, 2009, then the output string would be "18:08:2009":
    DateToString(mylink.mydate, "%dd:%mm:%yyyy")
    
DateToDecimal
Returns the given date as a packed decimal value. If your target decimal specifies a scale, part of the date appears after the decimal point. You can optionally specify a format string that specifies how the date is stored in the decimal number. The default format string is "%yyyy%mm%dd", so, for example, the date 2009-08-25 is stored as the decimal number 20090825. Format strings can only specify a format that contains numbers. For example, you cannot specify a format string such as "%yyyy-%mm-%dd", because the hyphen character (-) cannot be stored in a packed decimal value. The following tokens are valid for conversions to or from decimal values:

%yyyy (four-digit year)

%yy (two-digit year)

%NNNNyy (two-digit year with cutoff)

%mm (two-digit month)

%dd (two-digit day of month)

%ddd (three-digit day of year)

The literal digits 0 to 9 are also valid.

  • Input: basedate (date) [, format (string)]
  • Output: converted_date (decimal)
  • Examples. If the column mylink.basedate contains the date 2012-08-18, then the following function stores the date as the decimal number 18082012:
    DateToDecimal (mylink.basedate, "%dd%mm%yyyy")
    If the column mylink.basedate contains the date 2012-08-18, and the target column has a length of 10 and a scale of 2, then the following function stores the date as the decimal number 201208.18:
    DateToDecimal (mylink.basedate)
DecimalToDate
Returns the given packed decimal as a date. Both the sign and the scale of the decimal number are ignored when it is converted to a date. You can optionally specify a format string that specifies how the date is stored in the decimal number. The default format string is "%yyyy%mm%dd", so, for example, the date 2009-08-25 is stored as the decimal number 20090825. Format strings can only specify a format that contains numbers. For example, you cannot specify a format string such as "%yyyy-%mm-%dd", because the hyphen character (-) cannot be stored in a packed decimal value. The following tokens are valid for conversions to or from decimal values:

%yyyy (four-digit year)

%yy (two-digit year)

%NNNNyy (two-digit year with cutoff)

%mm (two-digit month)

%dd (two-digit day of month)

%ddd (three-digit day of year)

The literal digits 0 to 9 are also valid.

  • Input: basedec (decimal) [, format (string)]
  • Output: date
  • Examples. If the column mylink.mydecdata contains the value 18082012, then the following function returns the date 2012-08-18:
    DecimalToDate (mylink.basedate, "%dd%mm%yyyy")
    If the column mylink.mydecdata contains the value -201208.18, then the following function returns the date 2012-08-18:
    DecimalToDate (mylink.basedate)
DecimalToDecimal
Returns the given decimal in decimal representation with precision and scale specified in the target column definition. The argument rtype optionally specifies a rounding type, and is set to one of the following values:

ceil. Round the source field toward positive infinity. For example, 1.4 -> 2, -1.6 -> -1.

floor. Round the source field toward negative infinity. For example, 1.6 -> 1, -1.4 -> -2.

round_inf. Round or truncate the source field toward the nearest representable value, breaking ties by rounding positive values toward positive infinity and negative values toward negative infinity. For example, 1.4 -> 1, 1.5 -> 2, -1.4 -> -1, -1.5 -> -2.

trunc_zero. Discard any fractional digits to the right of the rightmost fractional digit supported in the destination, regardless of sign. For example, if the destination is an integer, all fractional digits are truncated. If the destination is another decimal with a smaller scale, round or truncate to the scale size of the destination decimal. For example, 1.6 -> 1, -1.6 -> -1.

  • Input: decimal (decimal) [,rtype (string)]
  • Output: result (decimal)
  • Examples. If the column mylink.mydec contains the decimal number 2.5345, the following function returns the decimal number 00000002.54.
    DecimalToDecimal(mylink.mydec,"ceil")
    
    The following function returns the decimal number 00000002.53.
    DecimalToDecimal(mylink.mydec,"floor")
    
    The following function returns the decimal number 00000002.53.
    DecimalToDecimal(mylink.mydec,"trunc_zero")
    
    The following function returns the decimal number 00000002.53.
    DecimalToDecimal(mylink.mydec,"round_inf")
    
    In all these examples, the target decimal has a length of 10 and a scale of 2.
DecimalToDFloat
Returns the given decimal in dfloat representation. The argument "fix_zero" optionally specifies that all zero decimal values are regarded as valid (by default, decimal numbers comprising all zeros are treated as invalid).
  • Input: decimal (decimal) [,"fix_zero"]
  • Output: result (dfloat)
  • Examples. If the column mylink.mydec contains the decimal number 00000004.00 the following function returns the dfloat number 4.00000000000000000E+00.
    DecimalToDFloat(mylink.mydec,"fix_zero")
    
    If the column mylink.mydec contains the decimal number 00012344.00 the following function returns the dfloat number 1.23440000000000000E+04.
    DecimalToDFloat(mylink.mydec,"fix_zero")
    
    If the column mylink.mydec contains the decimal number 00012344.120 the following function returns the dfloat number 1.23441200000000010E+04.
    DecimalToDFloat(mylink.mydec,"fix_zero")
    
    If the column mylink.mydec contains the decimal number 00012344.120 the following function returns the dfloat number 1.23441200000000010E+04.
    DecimalToDFloat(mylink.mydec)
    
    If the column mylink.mydec contains the decimal number 00012344.000 the following function returns the dfloat number 1.23440000000000000E+04.
    DecimalToDFloat(mylink.mydec)
    
DecimalToString
Returns the given decimal as a string. The argument "fix_zero" optionally specifies that all zero decimal values are regarded as valid (by default, decimal numbers comprising all zeros are treated as invalid). This covers the case where the sign bits of the packed decimal representation are all 0 as well as all the content digits. This cast is not considered valid unless "fix_zero" is true.
  • Input: decimal (decimal) [,"fix_zero"]
  • Output: result (string)
  • Examples. If the column mylink.mydec contains the decimal number 00000004.00, the following function returns the string "4":
    DecimalToString(mylink.mydec,"suppress_zero")
    
    If the column mylink.mydec contains the decimal number 00000004.00, the following function returns the string "0000000000000000000000000004.0000000000".
    DecimalToString(mylink.mydec,"fix_zero")
    
    If the column mylink.mydec contains the decimal number 00012344.00, the following function returns the string "12344".
    DecimalToString(mylink.mydec,"suppress_zero")
    
    If the column mylink.mydec contains the decimal number 00012344.00, the following function returns the string "0000000000000000000000012344.0000000000".
    DecimalToString(mylink.mydec,"fix_zero")
    
    If the column mylink.mydec contains the decimal number 00012344.120, the following function returns the string "0000000000000000000000012344.1200000000".
    DecimalToString(mylink.mydec,"fix_zero")
    
    If the column mylink.mydec contains the decimal number 00012344.120, the following function returns the string "12344.12".
    DecimalToString(mylink.mydec,"suppress_zero")
    
    If the column mylink.mydec contains the decimal number 00012344.120, the following function returns the string "00012344.120".
    DecimalToString(mylink.mydec)
    
    If the column mylink.mydec contains the decimal number 00012344.000, the following function returns the string "00012344.000".
    DecimalToString(mylink.mydec)
    
DecimalToTime
Returns the given packed decimal as a time. You can optionally specify a format string that specifies how the time is stored in the decimal number. The default format string is " %hh%nn%ss", so, for example, the time 14:03:22 is stored as the decimal number 140322. Format strings can only specify a format that contains numbers. For example, you cannot specify a format string such as "%hh:%nn:%ss", because the colon character (:) cannot be stored in a packed decimal value. The following tokens are valid for conversions to or from decimal values:

%hh (two-digit hours using 24-hour clock)

%nn (two-digit minutes)

%ss (two-digit seconds)

%ss.N (two-digit seconds, plus the number of fractional digits allowed. The number of fractional digits is from one to six inclusive).

The literal digits 0 to 9 are also valid.

If your specified format includes microseconds (for example, %ss.4), then the position of the decimal point is inferred in the decimal value. The position of the decimal point does not have to coincide with the specified scale of the decimal (for example, scale = 4).

  • Input: time (time) [, format (string)]
  • Output: result (decimal)
  • Examples: If the column mylink.mytimedec contains the decimal value 200658, then the following function returns the time 20:06:58:
    DecimalToTime(mylink.mytimedec)
    If the column mylink.mytimedec contains the decimal value 580620, then the following function returns the time 20:06:58:
    DecimalToTime(mylink.mytimedec, "%ss%nn%hh")
DecimalToTimestamp
Returns the given packed decimal as a timestamp. You can optionally specify a format string that specifies how the timestamp is stored in the decimal number. The default format string is " %yyyy%mm%dd%hh%nn%ss", so, for example, the timestamp 2009-08-25 14:03:22 is stored as the decimal number 20090825140322. Format strings can only specify a format that contains numbers. For example, you cannot specify a format string such as "%yyyy/%mm/%dd%hh:%nn:%ss", because the slash character (/) and the colon character (:) cannot be stored in a packed decimal value. The following tokens are valid for conversions to or from decimal values:

%yyyy (four-digit year)

%yy (two-digit year)

%NNNNyy (two-digit year with cutoff)

%mm (two-digit month)

%dd (two-digit day of month)

%ddd (three-digit day of year)

%hh (two-digit hours using 24-hour clock)

%nn (two-digit minutes)

%ss (two-digit seconds)

%ss.N (two-digit seconds, plus the number of fractional digits allowed. The number of fractional digits is from one to six inclusive).

The literal digits 0 to 9 are also valid.

If your specified format includes microseconds (for example, %ss.4), then the position of the decimal point is inferred in the decimal value. The position of the decimal point does not have to coincide with the specified scale of the decimal (for example, scale = 4).

  • Input: timestamp (timestamp) [, format (string)]
  • Output: result (decimal)
  • Examples: If the column mylink.mytimestampdec contains the value 19580818200658, then the following function returns the timestamp 1958–08–18 20:06:58:
    DecimalToTimestamp(mylink.mytimestampdec)
    If the column mylink.mytimestampdec contains the decimal value 200658580818, then the following function returns the timestamp 1958–08–18 20:06:58:
    DecimalToTimestamp(mylink.mytimestampdec, "%hh%nn%ss%yy%mm%dd")
DFloatToDecimal
Returns the given dfloat in decimal representation. The argument rtype optionally specifies a rounding type, and is set to one of the following values:

ceil. Round the source field toward positive infinity. For example, 1.4 -> 2, -1.6 -> -1.

floor. Round the source field toward negative infinity. For example, 1.6 -> 1, -1.4 -> -2.

round_inf. Round or truncate the source field toward the nearest representable value, breaking ties by rounding positive values toward positive infinity and negative values toward negative infinity. For example, 1.4 -> 1, 1.5 -> 2, -1.4 -> -1, -1.5 -> -2.

trunc_zero. Discard any fractional digits to the right of the rightmost fractional digit supported in the destination, regardless of sign. For example, if the destination is an integer, all fractional digits are truncated. If the destination is another decimal with a smaller scale, round or truncate to the scale size of the destination decimal. For example, 1.6 -> 1, -1.6 -> -1.

  • Input: number (dfloat), [rtype (string)]
  • Output: result (decimal)
  • Examples. If the column mylink.myfloat contains the dfloat number 2.534, the following function returns the decimal number 00000002.54.
    DFloatToDecimal(mylink.mydec,"ceil")
    
    If the column mylink.myfloat contains the dfloat number 2.534, the following function returns the decimal number 00000002.53.
    DFloatToDecimal(mylink.mydec,"floor")
    
    If the column mylink.myfloat contains the dfloat number 2.534, the following function returns the decimal number 00000002.53.
    DFloatToDecimal(mylink.mydec,"trunc_zero")
    
    If the column mylink.myfloat contains the dfloat number 2.534, the following function returns the decimal number 00000002.53.
    DFloatToDecimal(mylink.mydec,"round_inf")
    
DfloatToStringNoExp
Returns the given dfloat in its string representation with no exponent, using the specified scale.
  • Input: number (dfloat), scale (string)
  • Output: result (string)
  • Examples. If the column mylink.myfloat contains the dfloat number 2.534, then the following function returns the string 2.5:
    DfloatToStringNoExp(mylink.myfloat,2)
    
IsBase64
Returns whether the given string is type base 64 encoded.
  • Input: source string (string)
  • Output: result (int8)
  • Examples. If mylink.mystring1 contains a base 64 encoded string, then the following function returns the value 1.
    IsBase64(mylink.mystring1)
IsValid
Returns whether the given string is valid for the given type. Valid types are "date", "decimal", "dfloat", "sfloat", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "raw", "string", "time", "timestamp", "ustring". For data types of date, time, and timestamp, you can optionally specify a format string. The format string describes the format that your input data uses when it differs from the default formats for date, time, or timestamp. The default format for date is “%yyyy-%mm-%dd”. The default format for time is "%hh:%mm:%ss". The default format for timestamp is “%yyyy-%mm-%dd %hh:%mm:%ss". This function does not log warnings.
  • Input: type (string), teststring (string) [, format (string)]
  • Output: result (int8)
  • Examples. If the column mylink.mystring contains the string "1", then the following function returns the value 1.
    IsValid("int8",mylink.mystring)
    
    If the column mylink.mystring contains the string "380096.06", then the following function returns the value 0.
    IsValid("int8",mylink.mystring)
    
IsValidDate
Returns whether the given value is valid for the type date. This function logs warnings.
  • Input: testdate (date)
  • Output: result (int8)
  • Examples. If the column mylink.mydate contains the date 2011-09-13, then the following function returns the value 1.
    IsValidDate(mylink.mydate)
    
    If the column mylink.mydate contains the string "380096.06", then the following function returns the value 0, because the converted string is not a valid date.
    IsValidDate(StringToDate (mylink.mydate))
    
IsValidDecimal
Returns whether the given value is valid for the type decimal. If the allzerosflag is set to 0, then an all-zeroes representation is not valid. The allzerosflag is set to zero by default.
  • Input: testvalue (decimal) [, allzerosflag (uint8)]
  • Output: result (int8)
  • Examples. If the column mylink.mynum contains the value 310007.65, then the following function returns the value 1.
    IsValidDecimal(mylink.mynum)
    
    If the column mylink.mynum contains the string "wake-robin", then the following function returns the value 0, because the converted string is not a valid decimal.
    IsValidDecimal(StringToDecimal (mylink.mynum))
    
IsValidTime
Returns whether the given time is valid for the type time.
  • Input: testtime (time)
  • Output: result (int8)
  • Examples. If the column mylink.mytime contains the time 23:09:22, then the following function returns the value 1:
    IsValidTime(mylink.mytime)
    
    If the column mylink.mydate contains the string "IbnKayeed", then the following function returns the value 0, because the converted string is not a valid time.
    IsValidTime(StringToTime (mylink.mytime))
    
IsValidTimestamp
Returns whether the given timestamp is valid for the type timestamp.
  • Input: testtimestamp (timestamp)
  • Output: result (int8)
  • Examples. If the column mylink.mytimestamp contains the time 2011-09-13 23:09:22, then the following function returns the value 1:
    IsValidTimestamp(mylink.mytimestamp)
    
    If the column mylink.mytimestamp contains the string "one of two", then the following function returns the value 0, because the converted string is not a valid timestamp.
    IsValidTimestamp(StringToTimestamp (mylink.mytimestamp))
    
StrToNum
Converts string to number. This function is present for compatibility but use is not encouraged.
  • Input: string (string)
  • Output: result (dfloat)
StrToVar
Converts string to variant. This function is present for compatibility but use is not encouraged.
  • Input: string (string)
  • Output: result (string)
RawNumAt
Returns the integer value at the specified index value in the specified raw field. The index starts at 0.
  • Input: rawfield (raw), index (int32)
  • Output: result (int32)
  • Examples. If the column mylink.myraw contains a raw value derived from the string "hello", then the following function returns the integer 0x68 (the ASCII code for the character h):
    RawNumAt(mylink.myraw, 0)
    
    If the column mylink.myraw contains a raw value derived from the string "hello", then the following function returns 0 because the specified index is out of range:
    RawNumAt(mylink.myraw, 12)
    
RawToString
Returns the given raw value as a string representation. You must ensure that the raw input value contains a sequence of bytes that are valid as characters in the target character set in which the output string is used. For example, the raw value { 0xE0 0x41 0x42 } is not a valid sequence of UTF-8 characters, since the lead byte, 0xE0, is supposed to be followed by a byte in the range [0x80..0xBF]. If a raw value { xE0 x41 x42 } is passed to the RawToString function, there could be an error if the output string is then accessed as if it were encoded in UTF-8.
  • Input: rawfield (raw)
  • Output: result (string)
  • Examples. If the column mylink.myraw contains the value { 0x31 0x31 0x30 0x35 0x32 0x32 0x30 0x39 }, then the following function returns the string "11052209".
    RawNumAt(mylink.myraw)
    
Seq
Generates a numeric code value from an ASCII character. You can optionally specify the allow8bits argument to convert 8-bit ASCII values.
  • Input: Seq (char)
  • Output: result (number)
  • Examples. The following example outputs the character A as the ASCII code 65.
    Seq("A")
    
SeqAt
Returns the numeric code point value of the character at the specified position in the given string. The index starts at 0. If the specified index is out of range, the function returns 0.
  • Input: basestring (string), index (int32)
  • Output: result (int32)
  • Examples. If the column mylink.mystring contains the string "horse", then the following function returns the value 0x6F (that is, the ASCII value of the character o).
    SeqAt(mylink.mystring, 1)
    
StringToBase64
Encodes a string by using base 64 encoding.
  • Input: source string (string)
  • Output: result (string)
  • Examples. If mylink.mystring1 contains the string "Hello world", then the following function returns the base 64 encoded string.
    StringToBase64(mylink.mystring1)
MD5
Encodes a string by using the MD5 message-digest algorithm to a 128-bit hash value.
  • Input: source string (string)
  • Output: result (string)
  • Examples. If mylink.mystring1 contains the string "Hello world", then the following function returns the MD5 128-bit hash value.
    MD5(mylink.mystring1)
StringToDate
Returns a date from the given string in the given format. You do not have to specify a format string if your string contains a date in the default format yyyy-mm-dd.
  • Input: string (string) [,format (string)]
  • Output: result (date)
  • Examples: If the column mylink.mystring contains the string ″1958–08–18″, then the following function returns the date 1958–08–18.
    StringToDate(mylink.mystring)
    
    If the column mylink.mystring contains the string ″18:08:1958″, then the following function returns the date 1958–08–18.
    StringToDate(mylink.mystring,"%dd:%mm:%yyyy")
    
StringToDecimal
Returns the given string as a decimal representation. The argument rtype optionally specifies a rounding type, and is set to one of the following values:

ceil. Round the source field toward positive infinity. For example, 1.4 -> 2, -1.6 -> -1.

floor. Round the source field toward negative infinity. For example, 1.6 -> 1, -1.4 -> -2.

round_inf. Round or truncate the source field toward the nearest representable value, breaking ties by rounding positive values toward positive infinity and negative values toward negative infinity. For example, 1.4 -> 1, 1.5 -> 2, -1.4 -> -1, -1.5 -> -2.

trunc_zero. Discard any fractional digits to the right of the rightmost fractional digit supported in the destination, regardless of sign. For example, if the destination is an integer, all fractional digits are truncated. If the destination is another decimal with a smaller scale, round or truncate to the scale size of the destination decimal. For example, 1.6 -> 1, -1.6 -> -1.

  • Input: string (string), [rtype (string)]
  • Output: result (decimal)
  • Examples. If the column mylink.mystring contains the string "19982.22", and the target is defined as having a precision of 7 and a scale of 2, then the following function returns the decimal 19983.22.
    StringToDecimal(mylink.mystring)
    
    In the following examples, the column mylink.mystring contains the string "19982.2276", and the target is defined as having a precision of 7 and a scale of 2:
    • the function StringToDecimal(mylink.mystring,"ceil") returns the decimal 19983.23
    • the function StringToDecimal(mylink.mystring,"floor") returns the decimal 19983.22
    • the function StringToDecimal(mylink.mystring,"round_inf") returns the decimal 19983.23
    • the function StringToDecimal(mylink.mystring,"trunc_zero") returns the decimal 19983.22
StringToRaw
Returns a string in raw representation.
  • Input: string (string)
  • Output: result (raw)
  • Examples. If the column mylink.mystring contains the string "hello", and the target column is defined as being of type Binary then the following function returns the value { 0x68 0x65 0x6C 0x6C 0x6F }.
    StringToRaw(mylink.mystring)
    
StringToTime
Returns a time representation of the given string.
  • Input: string (string), [format (string)]
  • Output: result (time)
  • Examples: If the column mylink.mystring contains the string "20:06:58", then the function returns a time of 20:06:58.
    StringToTime(mylink.mystring)
    
    If the column mylink.mystring contains the string "20: 6:58", then the function returns a time of 20:06:58.
    StringToTime(mylink.mystring,"%(h,s):$(n,s):$(s,s)")
    
StringToTimestamp
Returns a time representation of the given string.
  • Input: string (string) [format (string)]
  • Output: result (time)
  • Examples: If the column mylink.mystring contains the string "1958–08–08 20:06:58", then the function returns the timestamp 1958–08–08 20:06:58.
    StringToTimestamp(mylink.mystring)
    
    If the column mylink.mystring contains the string "8/ 8/1958 20: 6:58", then the function returns the timestamp 1958–08–08 20:06:58.
    StringToTimestamp(mylink.mystring, "%(d,s)/%(m,s)/%yyyy%(h,s):$(n,s):$(s,s)")
    
StringToUstring
Returns a ustring from the given string, optionally using the specified map (otherwise uses project default).
  • Input: string (string), [mapname(string)]
  • Output: result (ustring)
  • Examples: If the column mylink.mystring contains the string "11052009", then the following function returns the ustring "11052009"
    StringToUstring(mylink.mystring)
    
NumToStr
Converts number to string. Precision indicates the maximum number of decimal places to be written. This function is present for compatibility but use is not encouraged.
  • Input: number (dfloat), precision (int32)
  • Output: result (string)
  • Examples: If the column mylink.precision contains the integer number 9, the following function returns the decimal number 0.333333333:
    NumToStr(AsDouble(1)/AsDouble(3), mylink.precision)
NumToStrFixed
Converts number to fixed string. Precision indicates the maximum number of decimal places to be written. This function is present for compatibility but use is not encouraged.
  • Input: number (dfloat), precision (int32)
  • Output: result (string)
  • Examples: If the column mylink.precision contains the integer number 9, the following function returns the decimal number 0.333333333:
    NumToStr(AsDouble(1)/AsDouble(3), mylink.precision)
NumToVar
Converts number to variant. This function is present for compatibility but use is not encouraged.
  • Input: number (dfloat)
  • Output: variant (string)
VarToNum
Converts variant to number. This function is present for compatibility but use is not encouraged.
  • Input: variant (string)
  • Output: number (dfloat)
VarToBool
Converts variant to boolean. This function is present for compatibility but use is not encouraged.
  • Input: variant (string)
  • Output: result (int32)
VarToStr
Converts variant to string. This function is present for compatibility but use is not encouraged.
  • Input: variant (string)
  • Output: result (string)
TimestampToDate
Returns a date from the given timestamp.
  • Input: timestamp (timestamp)
  • Output: result (date)
  • Examples: If the column mylink.mytimestamp contains the timestamp 1958–08–18 20:06:58, then the following function returns the date 1958–08–18:
    TimestampToDate(mylink.mytimestamp)
    
TimestampToDecimal
Returns the given timestamp as a packed decimal. You can optionally specify a format string that specifies how the timestamp is stored in the decimal number. The default format string is " %yyyy%mm%dd%hh%nn%ss", so, for example, the timestamp 2009-08-25 14:03:22 is stored as the decimal number 20090825140322. Format strings can only specify a format that contains numbers. For example, you cannot specify a format string such as "%yyyy/%mm/%dd%hh:%nn:%ss", because the slash character (/) and the colon character (:) cannot be stored in a packed decimal value. The following tokens are valid for conversions to or from decimal values:

%yyyy (four-digit year)

%yy (two-digit year)

%NNNNyy (two-digit year with cutoff)

%mm (two-digit month)

%dd (two-digit day of month)

%ddd (three-digit day of year)

%hh (two-digit hours using 24-hour clock)

%nn (two-digit minutes)

%ss (two-digit seconds)

%ss.N (two-digit seconds, plus the number of fractional digits allowed. The number of fractional digits is from one to six inclusive).

The literal digits 0 to 9 are also valid.

If your specified format includes microseconds (for example, %ss.4), then the position of the decimal point is inferred in the decimal value. The position of the decimal point does not have to coincide with the specified scale of the decimal (for example scale = 4).

  • Input: timestamp (timestamp) [, format (string)]
  • Output: result (decimal)
  • Examples: If the column mylink.mytimestamp contains the timestamp 1958–08–18 20:06:58, then the following function returns the decimal value 19580818200658:
    TimestampToDecimal(mylink.mytimestamp)
    If the column mylink.mytimestamp contains the timestamp 1958–08–18 20:06:58, then the following function returns the decimal value 200658580818:
    TimestampToDecimal(mylink.mytimestamp, "%hh%nn%ss%yy%mm%dd")
TimestampToString
Returns a string from the given timestamp.
  • Input: timestamp (timestamp) [format (string)]
  • Output: result (string)
  • Examples: If the column mylink.mytimestamp contains the timestamp 1958–08–1820:06:58, then the function returns the string "1958–08–1820:06:58".
    TimestampToString(mylink.mytimestamp)
    
    If the column mylink.mytimestamp contains the timestamp 1958–08–1820:06:58, then the function returns the string "18/08/1958 20:06:58":
    TimestampToString(mylink.mytimestamp, "%dd/%mm/%yyyy %hh:$nn:$ss")
    
TimestampToTime
Returns a time from the given timestamp.
  • Input: timestamp (timestamp)
  • Output: result (time)
  • Examples: If the column mylink.mytimestamp contains the timestamp 1958–08–1820:06:58, then the function returns the time 20:06:58:
    TimestampToTime(mylink.mytimestamp)
    
TimeToString
Returns a string from the given time.
  • Input: timestamp (timestamp) [format (string)]
  • Output: result (time)
  • Examples: If the column mylink.mytime contains the time 20:06:58, then the following function returns the string "20:06:58":
    TimeToString(mylink.mytime)
    
    If the column mylink.mytime contains the time 20:06:58, then the following function returns the string "58:06:20":
    TimeToString(mylink.mytime, "%ss:$nn:$hh")
    
TimeToDecimal
Returns the given time as a packed decimal. You can optionally specify a format string that specifies how the time is stored in the decimal number. The default format string is " %hh%nn%ss", so, for example, the time 14:03:22 is stored as the decimal number 140322. Format strings can only specify a format that contains numbers. For example, you cannot specify a format string such as "%hh:%nn:%ss", because the colon character (:) cannot be stored in a packed decimal value. The following tokens are valid for conversions to or from decimal values:

%hh (two-digit hours using 24-hour clock)

%nn (two-digit minutes)

%ss (two-digit seconds)

%ss.N (two-digit seconds, plus the number of fractional digits allowed. The number of fractional digits is from one to six inclusive).

The literal digits 0 to 9 are also valid.

If your specified format includes microseconds (for example, %ss.4), then the position of the decimal point is inferred in the decimal value. The position of the decimal point does not have to coincide with the specified scale of the decimal (for example scale = 4).

  • Input: time (time) [, format (string)]
  • Output: result (decimal)
  • Examples: If the column mylink.mytime contains the time 20:06:58, then the following function returns the decimal value 200658:
    TimeToDecimal(mylink.mytime)
    If the column mylink.mytime contains the time 20:06:58, then the following function returns the decimal value 580620:
    TimeToDecimal(mylink.mytime, "%ss%nn%hh")
UstringToString
Returns a string from the given ustring, optionally using the specified map (otherwise uses project default).
  • Input: string (ustring) [, mapname(string)]
  • Output: result (string)
  • Examples: If the column mylink.myustring contains the ustring "11052009", then the following function returns the string "11052009":
    UstringToString(mylink.myustring)
    
UniChar
Generates a single character from a Unicode value.
  • Input: unicode number (integer)
  • Output: single character from unicode (string)
  • Examples: If the column mylink.unicode contains the integer 241, then the following function returns the string "ñ":
    UniChar(mylink.unicode)
    
UniSeq
Generates a unicode value from expression.
  • Input: expression (string)
  • Output: unicode value(string)
  • Examples: If the column mylink.unicode contains the string "û", then the following function returns the unicode integer 251:
    UniSeq(mylink.expression)