Parallel Transform Functions Overview
Parallel Transform Functions Overview
The parallel transform functions are accessed from the expression editor under the Function menu item. You can use these functions when you define a derivation in a Transformer stage. The functions are described by category. This set includes functions that take string arguments or return string values. If you have national language support enabled, the arguments strings or returned strings can be strings or ustrings. The same function is used for either string type. The only exceptions are the functions StringToUstring () and UstringToString ().
Date and time functions You can use the date and time functions to perform various operations on dates and times in the Transformer stage. Logical functions The logical functions perform bit operations. Mathematical functions The mathematical functions perform mathematical operations. Null handling functions You can use the null handling functions in the Transformer stage to handle nulls in derivations. Number functions Use the number functions to extract the mantissa from a decimal or floating point number. The Number category in the expression editor also contains the type casting functions, which you can use to cast numbers as double, float, or integer data types. Raw functions Use the Raw function to obtain the length of the data in a column containing raw data. String functions Use the string functions to manipulate strings. Vector function Use the vector function to access an element in a vector column. Type conversion functions Use the type conversion functions to change the type of an argument. Utility functions The utility functions have a variety of purposes.
Input: any Output: true/false (int8) Examples. If the Derivation field for an output column contained the following code, then the Transformer stage checks if the input column named [Link] contains a null value. If the input column does not contain a null, the output column contains the value of the input column. If the input column does contain a null, then the output column contains the string NULL.
If IsNotNull([Link]) Then [Link] Else "NULL"
Input: any Output: true/false (int8) Examples. If the Derivation field for an output column contained the following code, then the Transformer stage checks if the input column named [Link] contains a null value. If the input column contains a null, the output column contains the string NULL. If the input column does not contain a null, then the output column contains the value of the input column.
If IsNull([Link]) Then "NULL" Else [Link]
NullToEmpty Returns an empty string if the input column is null, otherwise returns the input column value.
Examples. If the Derivation field for an output column contained the following code, then the Transformer stage checks if the input column named [Link] contains a null value. If the input column contains a null, the output column contains an empty string. If the input column does contain a null, then the output column contains the value from the input column.
NullToEmpty([Link])
NullToZero Returns zero if the input column is null, otherwise returns the input column value.
Input: input column Output: input column value or zero Examples. If the Derivation field for an output column contained the following code, then the Transformer stage checks if the input column named [Link] contains a null value. If the input column contains a null, the output column contains zero. If the input column does contain a null, then the output column contains the value from the input column.
NullToZeroy([Link])
NullToValue Returns the specified value if the input column is null, otherwise returns the input column value.
Input: input column, value Output: input column value or value Examples. If the Derivation field for an output column contained the following code, then the Transformer stage checks if the input column named [Link] contains a null value. If the input column contains a null, the output column contains 42. If the input column does contain a null, then the output column contains the value from the input column.
NullToValue([Link],42)
Input: Output: Examples. If the Derivation field for an output column contained the following code, then the Transformer stage sets the output column to null:
setnull()
For a date, the format is %yyyy-%mm-%dd For a time, the format is %hh:%nn:%ss. If extended to include microseconds, the format is %hh:%nn:%ss.x where x gives the number of decimal places seconds is given to. For a timestamp, the format is %yyyy-%mm-%dd %hh:%nn:%ss. If extended to include microseconds, the format is %yyyy-%mm-%dd %hh:%nn:%ss.x, where x gives the number of decimal places seconds is given to.
Functions that have days of week in the argument take a string specifying the day of the week. The day is specified as a three-letter abbreviation, or the full name. For example, the strings "thu" and "thursday" are both valid. The following functions are in the Date & Time category of the expression editor. Square brackets indicate an argument is optional. The examples show the function as it appears in a Derivation field in the Transformer stage. CurrentDate Returns the date that the job runs in date format.
Input: Output: date Examples. Use this function to add a new column containing the date to the data output by the Transformer stage:
CurrentDate()
CurrentTime Returns the time at which the job runs in time format.
Input: Output: time Examples. Use this function to add a new column containing the time to the data output by the Transformer stage:
CurrentTime()
CurrentTimeMS Returns the time at which the job runs in time format, the time includes microseconds.
Examples. Use this function to add a new column containing the time to the data output by the Transformer stage. You must set the Extended field in the column metadata to Microseconds to contain the full time:
CurrentTimeMS()
CurrentTimestamp Returns a timestamp giving the date and time that the job runs in timestamp format.
Input: Output: timestamp Examples. Use this function to add a new column containing the timestamp to the data output by the Transformer stage:
CurrentTimestamp()
CurrentTimestampMS Returns a timestamp giving the date and time that the job runs in timestamp format, the time part includes microseconds.
Input: Output: timestamp Examples. Use this function to add a new column containing the timestamp to the data output by the Transformer stage. You must set the Extended field in the column metadata to Microseconds to contain the full timestamp.
CurrentTimestampMS()
DateFromDaysSince Returns a date by adding an integer to a baseline date. The integer can be negative to return a date that is earlier than the base date.
Input: number (int32), [baseline_date (date)] Output: date Examples. If [Link] contains the integer 18250, and [Link] contains the date 19580818, then the three following functions are equivalent, and return the date 20080805:
DateFromDaysSince(18250,"1958-08-18") DateFromDaysSince([Link],"1958-08-18") DateFromDaysSince([Link],[Link])
If [Link] contains the integer -1, and [Link] contains the date 19580818, then the following three functions are equivalent, and return the date 19580817:
DateFromDaysSince(-1,"1958-08-18") DateFromDaysSince([Link],"1958-08-18") DateFromDaysSince([Link],[Link])
DateFromComponents Returns a date from the given years, months, and day of month given as three separate values.
Input: years (int32), months (int32), dayofmonth (int32) Output: date Examples. If [Link] contains the value 2010, [Link] contains the value 12, and [Link] contains the value 2, then the two following functions are equivalent, and return the date 2010 1202.
DateFromComponents(2010, 12, 2) DateFromComponents([Link], [Link], [Link])
Input: julianday (uint32) Output: date Examples. If [Link] contains the value 2454614, then the two following functions are equivalent, and return the date 20080527.
DateFromJulianDay(2454614) DateFromJulianDay([Link])
DateOffsetByComponents Returns the given date, with offsets applied from the given year offset, month offset, and day of month offset given as three separate values. The offset values can each be positive, zero, or negative.
Input: basedate (date), year_offset (int32), month_offset (int32), dayofmonth_offset (int32) Output: date Examples. If [Link] contains 2011-08-18 and [Link] contains the value 2, [Link] contains the value 0, and [Link] contains the value 0, then the two following functions are equivalent, and return the date 20130818.
DateOffsetByComponents("2011-08-18", 2011, 8, 18) DateOffsetByComponents([Link], [Link], [Link], [Link])
If [Link] contains 2011-08-18 and [Link] contains the value -2, [Link] contains the value 0, and [Link] contains the value 0, then the two following functions are equivalent, and return the date 20090818.
DateOffsetByComponents("2011-08-18", 2011, 8, 18) DateOffsetByComponents([Link], [Link], [Link], [Link])
DaysSinceFromDate Returns the number of days from source date to the given date.
Examples. If [Link] contains the date 19580818 and [Link] contains the date 20080818, then the two following functions are equivalent, and return the integer value 18263.
DaysSinceFromDate([Link], [Link]) DaysSinceFromDate("1958-08-18","2008-08-18")
DaysInMonth Returns the number of days in the month in the given basedate.
Input: basedate (date) Output: daysinmonth (int32) Examples. If [Link] contains the date 19580818, then the two following functions are equivalent, and return the integer value 31.
DaysInMonth([Link]) DaysInMonth("1958-08-18")
DaysInYear Returns the number of days in the year in the given basedate.
Input: basedate (date) Output: daysinyearh (int32) Examples. If [Link] contains the date 20120818, then the two following functions are equivalent, and return the integer value 366.
DaysInYear([Link]) DaysInYear("2012-08-18")
If [Link] contains the date 20110818, then the two following functions are equivalent, and return the integer value 365.
DaysInYear([Link]) DaysInYear("2011-08-18")
DateOffsetByDays Returns the given date, offset by the given number of days. The offset value can be positive, zero, or negative.
Input: basedate (date), dayoffset (int32) Output: date Examples. If [Link] contains 2011-08-18 and [Link] contains the value 2, then the two following functions are equivalent, and return the date 20110820.
DateOffsetByDays("2011-08-18", 2) DateOffsetByDays([Link], [Link])
If [Link] contains 2011-08-18 and [Link] contains the value -31, then the two following functions are equivalent, and return the date 20110718.
DateOffsetByDays("2011-08-18", -31) DateOffsetByDays([Link], [Link])
HoursFromTime
Input: time Output: hours (int8) Examples. If [Link] contains the time [Link], then the following two functions are equivalent, and return the integer value 22.
HoursFromTime([Link]) HoursFromTime("[Link]")
Input: date Output: julianday (int32) Examples. If [Link] contains the date 20080527, then the two following functions are equivalent, and return the value 2454614.
JulianDayFromDate("20080527") JulianDayFromDate([Link])
Input: time Output: microseconds (int32) Examples. If [Link] contains the time [Link].32, then the following function returns the value 320000:
MicroSecondsFromTime([Link])
MidnightSecondsFromTime Returns the number of seconds from midnight to the given time.
Input: time Output: seconds (int8) Examples. If [Link] contains the time [Link], then the two following functions are equivalent, and return the value 1852:
MidnightSecondsFromTime("[Link]") MidnightSecondsFromTime([Link])
Input: time Output: minutes (int8) Examples. If [Link] contains the time [Link], then the two following functions are equivalent, and return the value 30:
MinutesFromTime("[Link]") MinutesFromTime([Link])
MonthDayFromDate Returns the day of the month from the given date.
Input: date Output: day (int8) Examples. If [Link] contains the date 2008-08-18, then the two following functions are equivalent, and return the value 18:
MonthDayFromDate("2008-08-18") MonthDayFromDate([Link])
Input: date Output: month_number (int8) Examples. If [Link] contains the date 2008-08-18, then the two following functions are equivalent, and return the value 8:
MonthFromDate("2008-08-18") MonthDayDate([Link])
NextWeekdayFromDate Returns the date of the specified day of the week soonest after the source date. The day of the week is specified as the full name, for example, thursday, or a three-letter abbreviation, for example, thu.
Input: sourcedate (date), day_of_week (string) Output: date Examples. If [Link] contains the date 2008-08-18, then the two following functions are equivalent, and return the value 20080821:
NextWeekdayFromDate("2008-08-18", "thursday") NextWeekdayFromDate([Link], "thu")
NthWeekdayFromDate Returns the date of the specified day of the week offset by the specified number of weeks from the source date. The day of the week is specified as the full name, for example, thursday, or a three-letter abbreviation, for example, thu. The offset can be positive, negative, or zero.
Input: basedate (date), day_of_week (string), week_offset (int32) Output: date Examples. If [Link] contains the date 2009-08-18, then the two following functions are equivalent, and return the value 20090827:
NthWeekdayFromDate("2009-08-18", "thursday", 1) NthWeekdayFromDate([Link], "thu", 1)
If [Link] contains the date 2009-08-18, then the two following functions are equivalent, and return the value 20090806:
NthWeekdayFromDate("2009-08-18", "thursday", -2) NthWeekdayFromDate([Link], "thu", -2)
PreviousWeekdayFromDate Returns the date of the specified day of the week most recent before the source date. The day of the week is specified as the full name, for example, thursday, or a three-letter abbreviation, for example, thu.
Input: sourcedate, day_of_week (string) Output: date Examples. If [Link] contains the date 2008-08-18, then the two following functions are equivalent, and return the value 20080814:
PreviousWeekdayFromDate("2008-08-18", "thursday") PreviousWeekdayFromDate([Link], "thu")
Input: time Output: seconds (dfloat) Examples. If [Link] contains the time [Link], then the two following functions are equivalent, and return the value 52:
SecondsFromTime("[Link]") SecondsFromTime([Link])
Input: timestamp, timestamp_base Output: seconds (dfloat) Examples. If [Link] contains the timestamp 20080818 [Link], and mylink.mytimestamp_base contains the timestamp 2008 0819 [Link], then the two following functions are equivalent, and return the value -86400:
SecondsSinceFromTimestamp("20080818 [Link]","20080819 [Link]") SecondsSinceFromTimestamp([Link], mylink.mytimestamp_base)
Input: Output: system time and date (string) Examples. If the job was run at 4.21 pm on June 20th 2008, then the following function returns the string "[Link] 20 Jun 2008".
TimeDate()
TimeFromComponents Returns a time from the given hours, minutes, seconds and microseconds given as four separate values.
Input: hours (int32), minutes (int32), seconds (int32), microseconds (int32) Output: time Examples. If [Link] contains the value 10, [Link] contains the value 12, [Link] contains the value 2, and [Link] contains 0, then the two following functions are equivalent, and return the time [Link].0:
TimeFromMidnightSeconds Returns the time given the number of seconds since midnight.
Input: seconds (dfloat) Output: time Examples. If [Link] contains the value 240, then the two following functions are equivalent, and return the value [Link]
TimeFromMidnightSeconds("240") TimeFromMidnightSeconds([Link])
TimeOffsetByComponents Returns the given time, with offsets applied from the given hour offset, minute offset, and second offset, each given as separate values. The seconds offset can include partial seconds.
Input: basetime (time), hour_offset (int32), minute_offset (int32), second_offset (dfloat) Output: time Examples. If [Link] contains [Link] and [Link] contains the value 2, [Link] contains the value 0, [Link] contains the value 20, then the two following functions are equivalent, and return the time [Link].
TimeOffsetByComponents("[Link]", 2, 0, 20) TimeOffsetByComponents([Link], [Link], [Link], [Link])
TimeOffsetBySeconds Returns the given time, with offsets applied from the given seconds offset. The seconds offset can include partial seconds.
Input: basetime (time), second_offset (dfloat) Output: time Examples. If [Link] contains [Link].30 and [Link] contains the value 2.5, then the two following functions are equivalent, and return the time [Link].80:
TimeOffsetByComponents("[Link].30", 2.5) TimeOffsetByComponents([Link], [Link])
Input: date time Output: timestamp Examples. If [Link] contains the date 20080818 and [Link] contains the time [Link], then the two following functions are equivalent, and return the timestamp 20080818 [Link]
TimestampFromDateTime("20080818","[Link]") TimestampFromDateTime([Link],[Link])
TimestampFromSecondsSince Returns a timestamp derived from the number of seconds from the base timestamp.
Input: seconds (dfloat), [base_timestamp] Output: timestamp Examples. If [Link] contains the value 2563 and mylink.timestamp_base contains the timestamp 20080818 [Link], then the two following functions are equivalent, and return the timestamp 20080818 [Link]
TimestampFromSecondsSince("2563","20080818 [Link]") TimestampFromSecondsSince([Link],[Link] _base)
Input: timet (int32) Output: timestamp Examples. If [Link] contains the value 1234567890, then the two following functions are equivalent, and return the timestamp 2009 0213 [Link]
TimestampFromTimet("1234567890") TimestampFromTimet([Link])
TimestampOffsetByComponents Returns the given timestamp, with offsets applied from the given year offset, month offset, day offset, hour offset, minute offset, and second offset, each given as separate values. The seconds offset can include partial seconds.
Input: basetimestamp (timestamp), year_offset (int32), month_offset (int32), dayofmonth_offset (int32), hour_offset (int32), minute_offset (int32), second_offset (dfloat) Output: timestamp Examples. If [Link] contains 2009-08-18 [Link] and [Link] contains 0, [Link] contains the value 2, [Link] contains the value -4, [Link] contains the value 2, [Link] contains the value 0, [Link] contains the value 20, then the two following functions are equivalent, and return the timestamp 2009-10-14 [Link].
TimestampOffsetByComponents("2009-08-18 [Link]", 0, 2, 4, 2, 0, 20) TimestampOffsetByComponents([Link], [Link], [Link], [Link])
TimestampOffsetBySeconds Returns the given timestamp, with offsets applied from the given seconds offset. The seconds offset can include partial seconds.
Output: timestamp Examples. If [Link] contains 2009-08-18 [Link] and [Link] contains the value 32760, then the two following functions are equivalent, and return the timestamp 2009-08-18 [Link]
TimeOffsetBySeconds("2009-08-18 [Link]", 32760) TimeOffsetBySeconds ([Link], [Link])
Input: timestamp Output: timet (int32) Examples. If [Link] contains the value 20090213 [Link], then the two following functions are equivalent, and return the value 1234567890:
TimestampFromTimet("20090213 [Link]") TimestampFromTimet([Link])
WeekdayFromDate Returns the day number of the week from the given date. Origin_day optionally specifies the day regarded as the first in the week and is Sunday by default.
Input: date, [origin_day] Output: day (int8) Examples. If [Link] contains the date 2008-08-18, then the two following functions are equivalent, and return the value 1:
WeekdayFromDate("2008-08-18") WeekdayFromDate([Link])
If [Link] contains the date 2008-08-18, and mylink.origin_day contains saturday, then the two following functions are equivalent, and return the value 2:
WeekdayFromDate("2008-08-18","saturday") WeekdayFromDate([Link],mylink.origin_day)
YeardayFromDate Returns the day number in the year from the given date.
Input: date Output: day (int16) Examples. If [Link] contains the date 2008-08-18, then the two following functions are equivalent, and return the value 231:
YeardayFromDate("2008-08-18") YeardayFromDate([Link])
Examples. If [Link] contains the date 2008-08-18, then the two following functions are equivalent, and return the value 2008:
YearFromDate("2008-08-18") YearFromDate([Link])
YearweekFromDate Returns the week number in the year from the given date
Input: date Output: week (int16) Examples. If [Link] contains the date 2008-08-18, then the two following functions are equivalent, and return the value 33:
YearweekFromDate("2008-08-18") YearweekFromDate([Link])
Input: code (number), [allow8bits] Output: result (char) Examples. The following example outputs the ASCII code 65 as the character A.
Char(65)
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 [Link] to a string. If [Link] contains the date 18th August, 2009, then the output string is "2009-08-18":
DateToString([Link])
The following example outputs the date contained in the column [Link] to a string with the format dd:mm:yyyy. If [Link] contained the date 18th August, 2009, then the output string would be "[Link]":
DateToString([Link], "%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 200908-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 [Link] contains the date 2012-08-18, then the following function stores the date as the decimal number 18082012:
DateToDecimal ([Link], "%dd%mm%yyyy")
If the column [Link] 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 ([Link])
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 200908-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 [Link] contains the value 18082012, then the following function returns the date 2012-08-18:
DecimalToDate ([Link], "%dd%mm%yyyy")
If the column [Link] contains the value -201208.18, then the following function returns the date 2012-08-18:
DecimalToDate ([Link])
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 [Link] contains the decimal number 2.5345, the following function returns the decimal number 00000002.54.
DecimalToDecimal([Link],"ceil")
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 [Link] contains the decimal number 00000004.00 the following function returns the dfloat number 4.00000000000000000E+00.
DecimalToDFloat([Link],"fix_zero")
If the column [Link] contains the decimal number 00012344.00 the following function returns the dfloat number 1.23440000000000000E+04.
DecimalToDFloat([Link],"fix_zero")
If the column [Link] contains the decimal number 00012344.120 the following function returns the dfloat number 1.23441200000000010E+04.
DecimalToDFloat([Link],"fix_zero")
If the column [Link] contains the decimal number 00012344.120 the following function returns the dfloat number 1.23441200000000010E+04.
DecimalToDFloat([Link])
If the column [Link] contains the decimal number 00012344.000 the following function returns the dfloat number 1.23440000000000000E+04.
DecimalToDFloat([Link])
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 [Link] contains the decimal number 00000004.00, the following function returns the string "4":
DecimalToString([Link],"suppress_zero")
If the column [Link] contains the decimal number 00000004.00, the following function returns the string "0000000000000000000000000004.0000000000".
DecimalToString([Link],"fix_zero")
If the column [Link] contains the decimal number 00012344.00, the following function returns the string "12344".
DecimalToString([Link],"suppress_zero")
If the column [Link] contains the decimal number 00012344.00, the following function returns the string "0000000000000000000000012344.0000000000".
DecimalToString([Link],"fix_zero")
If the column [Link] contains the decimal number 00012344.120, the following function returns the string "0000000000000000000000012344.1200000000".
DecimalToString([Link],"fix_zero")
If the column [Link] contains the decimal number 00012344.120, the following function returns the string "12344.12":
DecimalToString([Link],"suppress_zero")
If the column [Link] contains the decimal number 00012344.120, the following function returns the string "0000000000000000000000012344.120000000".
DecimalToString([Link])
If the column [Link] contains the decimal number 00012344.000, the following function returns the string "0000000000000000000000012344.0000000000".
DecimalToString([Link])
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 [Link] 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 [Link] contains the decimal value 200658, then the following function returns the time [Link]
DecimalToTime([Link])
If the column [Link] contains the decimal value 580620, then the following function returns the time [Link]
DecimalToTime([Link], "%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 [Link] 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 [Link] contains the value 19580818200658, then the following function returns the timestamp 19580818 [Link]
DecimalToTimestamp([Link])
If the column [Link] contains the decimal value 200658580818, then the following function returns the timestamp 1958 0818 [Link]
DecimalToTimestamp([Link], "%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.
Examples. If the column [Link] contains the dfloat number 2.534, the following function returns the decimal number 00000002.54.
DFloatToDecimal([Link],"ceil")
If the column [Link] contains the dfloat number 2.534, the following function returns the decimal number 00000002.53.
DFloatToDecimal([Link],"floor")
If the column [Link] contains the dfloat number 2.534, the following function returns the decimal number 00000002.53.
DFloatToDecimal([Link],"trunc_zero")
If the column [Link] contains the dfloat number 2.534, the following function returns the decimal number 00000002.53.
DFloatToDecimal([Link],"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 [Link] contains the dfloat number 2.534, then the following function returns the string 00000002.50:
DfloatToStringNoExp([Link],2)
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".
Input: type (string), teststring (string) [, format (string)] Output: result (int8) Examples. If the column [Link] contains the string "1", then the following function returns the value 1.
IsValid("int8",[Link])
If the column [Link] contains the string "380096.06", then the following function returns the value 0.
IsValid("int8",[Link])
IsValidDate Returns whether the given value is valid for the type date.
Input: testdate (date) Output: result (int8) Examples. If the column [Link] contains the date 2011-09-13, then the following function returns the value 1.
IsValidDate([Link])
If the column [Link] contains the string "380096.06", then the following function returns the value 0, because the converted string is not a valid date.
IsValidDate(StringTodate ([Link]))
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 [Link] contains the value 310007.65, then the following function returns the value 1.
IsValidDecimal([Link])
If the column [Link] contains the string "wake-robin", then the following function returns the value 0, because the converted string is not a valid decimal.
IsValidDecimal(StringToDecimal ([Link]))
IsValidTime Returns whether the given time is valid for the type time.
Input: testtime (time) Output: result (int8) Examples. If the column [Link] contains the time [Link], then the following function returns the value 1:
IsValidTime([Link])
If the column [Link] contains the string "IbnKayeed", then the following function returns the value 0, because the converted string is not a valid time.
IsValidTime(StringToTime ([Link]))
IsValidTimestamp Returns whether the given timestamp is valid for the type timestamp.
Input: testtimestamp (timestamp) Output: result (int8) Examples. If the column [Link] contains the time 2011-0913 [Link], then the following function returns the value 1:
IsValidTimestamp([Link])
If the column [Link] 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 ([Link]))
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 [Link] 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([Link], 0)
If the column [Link] contains a raw value derived from the string "hello", then the following function returns 0 because the specified index is out of range:
RawNumAt([Link], 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.
Output: result (string) Examples. If the column [Link] contains the value { 0x31 0x31 0x30 0x35 0x32 0x32 0x30 0x39 }, then the following function returns the string "11052209".
RawNumAt([Link])
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 [Link] contains the string "horse", then the following function returns the value 0x6F (that is, the ASCII value of the character o).
SeqAt([Link], 1)
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 yyyymm-dd.
Input: string (string) [,format (string)] Output: result (date) Examples: If the column [Link] contains the string 195808 18, then the following function returns the date 19580818.
StringToDate([Link])
If the column [Link] contains the string [Link], then the following function returns the date 19580818.
StringToDate([Link],"%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 [Link] 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([Link])
If the column [Link] contains the string "19982.2276", and the target is defined as having a precision of 7 and a scale of 2, then the following function returns the decimal 19983.23.
StringToDecimal([Link],"ceil")
Input: string (string) Output: result (raw) Examples. If the column [Link] 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([Link])
Input: string (string), [format (string)] Output: result (time) Examples: If the column [Link] contains the string "[Link]", then the function returns a time of [Link].
StringToTime([Link])
If the column [Link] contains the string "20: 6:58", then the function returns a time of [Link].
StringToTime([Link],"%(h,s):$(n,s):$(s,s)")
Input: string (string) [format (string)] Output: result (time) Examples: If the column [Link] contains the string "195808 08 [Link]", then the function returns the timestamp 19580808 [Link].
StringToTimestamp([Link])
If the column [Link] contains the string "8/ 8/1958 20: 6:58", then the function returns the timestamp 19580808 [Link].
StringToTimestamp([Link], "%(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 [Link] contains the string "11052009", then the following function returns the ustring "11052009"
StringToUstring([Link])
Input: timestamp (timestamp) Output: result (date) Examples: If the column [Link] contains the timestamp 19580818 [Link], then the following function returns the date 1958 0818:
TimestampToDate([Link])
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 [Link] 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 [Link] contains the timestamp 19580818 [Link], then the following function returns the decimal value 19580818200658:
TimestampToDecimal([Link])
If the column [Link] contains the timestamp 19580818 [Link], then the following function returns the decimal value 200658580818:
TimestampToDecimal([Link], "%hh%nn%ss%yy%mm%dd")
Input: timestamp (timestamp) [format (string)] Output: result (string) Examples: If the column [Link] contains the timestamp 195808[Link], then the function returns the string "195808 [Link]".
TimestampToString([Link])
If the column [Link] contains the timestamp 195808 [Link], then the function returns the string "18/08/1958 [Link]":
TimestampToString([Link], "%dd/%mm/%yyyy %hh:$nn:$ss")
Input: timestamp (timestamp) Output: result (time) Examples: If the column [Link] contains the timestamp 195808[Link], then the function returns the time [Link]
TimestampToTime([Link])
Input: timestamp (timestamp) [format (string)] Output: result (time) Examples: If the column [Link] contains the time [Link], then the following function returns the string "[Link]":
TimeToString([Link])
If the column [Link] contains the time [Link], then the following function returns the string "[Link]":
TimeToString([Link], "%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 [Link] 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 [Link] contains the time [Link], then the following function returns the decimal value 200658:
TimeToDecimal([Link])
If the column [Link] contains the time [Link], then the following function returns the decimal value 580620:
TimeToDecimal([Link], "%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 [Link] contains the ustring "11052009", then the following function returns the string "11052009":
UstringToString([Link])