transformer all functions in datastage

47
Date and time functions You can use the date and time functions to perform various operations on dates and times in the Transformer stage. Functions that specify dates, times, or timestamps in the arguments use strings with specific formats: 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 threeletter 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. Input:

Upload: dulce-vallejo

Post on 28-Sep-2015

581 views

Category:

Documents


48 download

DESCRIPTION

Transformer All Functions in Datastage

TRANSCRIPT

  • DateandtimefunctionsYoucanusethedateandtimefunctionstoperformvariousoperationsondatesandtimesintheTransformerstage.Functionsthatspecifydates,times,ortimestampsintheargumentsusestringswithspecificformats:

    Foradate,theformatis%yyyy%mm%dd Foratime,theformatis%hh:%nn:%ss.Ifextendedtoincludemicroseconds,theformat

    is%hh:%nn:%ss.xwherexgivesthenumberofdecimalplacessecondsisgivento. Foratimestamp,theformatis%yyyy%mm%dd%hh:%nn:%ss.Ifextendedtoinclude

    microseconds,theformatis%yyyy%mm%dd%hh:%nn:%ss.x,wherexgivesthenumberofdecimalplacessecondsisgivento.Functionsthathavedaysofweekintheargumenttakeastringspecifyingthedayoftheweek.Thedayisspecifiedasathreeletterabbreviation,orthefullname.Forexample,thestrings"thu"and"thursday"arebothvalid.ThefollowingfunctionsareintheDate&Timecategoryoftheexpressioneditor.Squarebracketsindicateanargumentisoptional.TheexamplesshowthefunctionasitappearsinaDerivationfieldintheTransformerstage.CurrentDate

    Returnsthedatethatthejobrunsindateformat. Input:

    Output:date Examples.Usethisfunctiontoaddanewcolumncontainingthedateto

    thedataoutputbytheTransformerstage: CurrentDate()

    CurrentTimeReturnsthetimeatwhichthejobrunsintimeformat.

    Input:

    Output:time Examples.Usethisfunctiontoaddanewcolumncontainingthetimeto

    thedataoutputbytheTransformerstage: CurrentTime()

    CurrentTimeMSReturnsthetimeatwhichthejobrunsintimeformat,thetimeincludesmicroseconds.

    Input:

  • Output:time Examples.Usethisfunctiontoaddanewcolumncontainingthetimeto

    thedataoutputbytheTransformerstage.YoumustsettheExtendedfieldinthecolumnmetadatatoMicrosecondstocontainthefulltime:

    CurrentTimeMS()CurrentTimestamp

    Returnsatimestampgivingthedateandtimethatthejobrunsintimestampformat.

    Input:

    Output:timestamp Examples.Usethisfunctiontoaddanewcolumncontainingthe

    timestamptothedataoutputbytheTransformerstage: CurrentTimestamp()

    CurrentTimestampMSReturnsatimestampgivingthedateandtimethatthejobrunsintimestampformat,thetimepartincludesmicroseconds.

    Input:

    Output:timestamp Examples.Usethisfunctiontoaddanewcolumncontainingthe

    timestamptothedataoutputbytheTransformerstage.YoumustsettheExtendedfieldinthecolumnmetadatatoMicrosecondstocontainthefulltimestamp.

    CurrentTimestampMS()DateFromDaysSince

    Returnsadatebyaddinganintegertoabaselinedate.Theintegercanbenegativetoreturnadatethatisearlierthanthebasedate.

    Input:number(int32),[baseline_date(date)]

    Output:date Examples.Ifmylink.myintcolcontainstheinteger18250,and

    mylink.mydatecolcontainsthedate19580818,thenthethreefollowingfunctionsareequivalent,andreturnthedate20080805:

    DateFromDaysSince(18250,"19580818") DateFromDaysSince(mylink.myintcol,"19580818")

    DateFromDaysSince(mylink.myintcol,mylink.mydatecol)Ifmylink.mynegintcolcontainstheinteger1,andmylink.mydatecolcontainsthedate19580818,thenthefollowingthreefunctionsareequivalent,andreturnthedate19580817:DateFromDaysSince(1,"19580818")DateFromDaysSince(mylink.mynegintcol,"19580818")DateFromDaysSince(mylink.mynegintcol,mylink.mydatecol)

    DateFromComponents

  • Returnsadatefromthegivenyears,months,anddayofmonthgivenasthreeseparatevalues.

    Input:years(int32),months(int32),dayofmonth(int32)

    Output:date Examples.Ifmylink.yearcolcontainsthevalue2010,mylink.monthcol

    containsthevalue12,andmylink.dayofmonthcolcontainsthevalue2,thenthetwofollowingfunctionsareequivalent,andreturnthedate20101202.

    DateFromComponents(2010,12,2)DateFromComponents(mylink.yearcol,mylink.monthcol,mylink.dayofmonthcol)

    DateFromJulianDayReturnsadatefromthegivenjulianday.

    Input:julianday(uint32)

    Output:date Examples.Ifmylink.myjulcolcontainsthevalue2454614,thenthetwo

    followingfunctionsareequivalent,andreturnthedate20080527. DateFromJulianDay(2454614)

    DateFromJulianDay(mylink.myjulcol)DateOffsetByComponents

    Returnsthegivendate,withoffsetsappliedfromthegivenyearoffset,monthoffset,anddayofmonthoffsetgivenasthreeseparatevalues.Theoffsetvaluescaneachbepositive,zero,ornegative.

    Input:basedate(date),year_offset(int32),month_offset(int32),dayofmonth_offset(int32)

    Output:date Examples.Ifmylink.basedatecontains20110818andmylink.yearos

    containsthevalue2,mylink.monthoscontainsthevalue0,andmylink.dayofmonthosolcontainsthevalue0,thenthetwofollowingfunctionsareequivalent,andreturnthedate20130818.

    DateOffsetByComponents("20110818",2011,8,18) DateOffsetByComponents(mylink.basedate,mylink.yearos,

    mylink.monthos,mylink.dayofmonthos)

    Ifmylink.basedatecontains20110818andmylink.yearoscontainsthevalue2,mylink.monthoscontainsthevalue0,andmylink.dayofmonthosolcontainsthevalue0,thenthetwofollowingfunctionsareequivalent,andreturnthedate20090818.

    DateOffsetByComponents("20110818",2011,8,18) DateOffsetByComponents(mylink.basedate,mylink.yearos,

    mylink.monthos,mylink.dayofmonthos)

  • DaysSinceFromDateReturnsthenumberofdaysfromsourcedatetothegivendate.

    Input:source_date,given_date

    Output:days_since(int32) Examples.Ifmylink.mysourcedatecontainsthedate19580818and

    mylink.mygivendatecontainsthedate20080818,thenthetwofollowingfunctionsareequivalent,andreturntheintegervalue18263.

    DaysSinceFromDate(mylink.mysourcedate,mylink.mygivendate)DaysSinceFromDate("19580818","20080818")

    DaysInMonthReturnsthenumberofdaysinthemonthinthegivenbasedate.

    Input:basedate(date)

    Output:daysinmonth(int32) Examples.Ifmylink.mysourcedatecontainsthedate19580818,then

    thetwofollowingfunctionsareequivalent,andreturntheintegervalue31. DaysInMonth(mylink.mysourcedate)

    DaysInMonth("19580818")DaysInYear

    Returnsthenumberofdaysintheyearinthegivenbasedate. Input:basedate(date)

    Output:daysinyearh(int32) Examples.Ifmylink.mysourcedatecontainsthedate20120818,then

    thetwofollowingfunctionsareequivalent,andreturntheintegervalue366.

    DaysInYear(mylink.mysourcedate)DaysInYear("20120818")Ifmylink.mysourcedatecontainsthedate20110818,thenthetwofollowingfunctionsareequivalent,andreturntheintegervalue365.DaysInYear(mylink.mysourcedate)DaysInYear("20110818")

    DateOffsetByDaysReturnsthegivendate,offsetbythegivennumberofdays.Theoffsetvaluecanbepositive,zero,ornegative.

    Input:basedate(date),dayoffset(int32)

    Output:date Examples.Ifmylink.basedatecontains20110818andmylink.dayoffset

    containsthevalue2,thenthetwofollowingfunctionsareequivalent,andreturnthedate20110820.

    DateOffsetByDays("20110818",2)DateOffsetByDays(mylink.basedate,mylink.dayoffset)

  • Ifmylink.basedatecontains20110818andmylink.dayoffsetcontainsthevalue31,thenthetwofollowingfunctionsareequivalent,andreturnthedate20110718.

    DateOffsetByDays("20110818",31)DateOffsetByDays(mylink.basedate,mylink.dayoffset)

    HoursFromTimeReturnsthehourportionofatime.

    Input:time

    Output:hours(int8) Examples.Ifmylink.mytimecontainsthetime22:30:00,thenthe

    followingtwofunctionsareequivalent,andreturntheintegervalue22. HoursFromTime(mylink.mytime)

    HoursFromTime("22:30:00")JulianDayFromDate

    Returnsajuliandayfromthegivendate. Input:date

    Output:julianday(int32) Examples.Ifmylink.mydatecontainsthedate20080527,thenthetwo

    followingfunctionsareequivalent,andreturnthevalue2454614. JulianDayFromDate("20080527")

    JulianDayFromDate(mylink.mydate)MicroSecondsFromTime

    Returnsthemicrosecondportionofatime. Input:time

    Output:microseconds(int32) Examples.Ifmylink.mytimecontainsthetime22:30:00.32,thenthe

    followingfunctionreturnsthevalue320000:MicroSecondsFromTime(mylink.mytime)

    MidnightSecondsFromTimeReturnsthenumberofsecondsfrommidnighttothegiventime.

    Input:time

    Output:seconds(int8) Examples.Ifmylink.mytimecontainsthetime00:30:52,thenthetwo

    followingfunctionsareequivalent,andreturnthevalue1852: MidnightSecondsFromTime("00:30:52")

    MidnightSecondsFromTime(mylink.mytime)MinutesFromTime

    Returnstheminuteportionofatime. Input:time

  • Output:minutes(int8) Examples.Ifmylink.mytimecontainsthetime22:30:52,thenthetwo

    followingfunctionsareequivalent,andreturnthevalue30: MinutesFromTime("22:30:52")

    MinutesFromTime(mylink.mytime)MonthDayFromDate

    Returnsthedayofthemonthfromthegivendate. Input:date

    Output:day(int8) Examples.Ifmylink.mydatecontainsthedate20080818,thenthetwo

    followingfunctionsareequivalent,andreturnthevalue18: MonthDayFromDate("20080818")

    MonthDayFromDate(mylink.mydate)MonthFromDate

    Returnsthemonthnumberfromthegivendate. Input:date

    Output:month_number(int8) Examples.Ifmylink.mydatecontainsthedate20080818,thenthetwo

    followingfunctionsareequivalent,andreturnthevalue8: MonthFromDate("20080818")

    MonthDayDate(mylink.mydate)NextWeekdayFromDate

    Returnsthedateofthespecifieddayoftheweeksoonestafterthesourcedate.Thedayoftheweekisspecifiedasthefullname,forexample,thursday,orathreeletterabbreviation,forexample,thu.

    Input:sourcedate(date),day_of_week(string)

    Output:date Examples.Ifmylink.mysourcedatecontainsthedate20080818,thenthe

    twofollowingfunctionsareequivalent,andreturnthevalue20080821: NextWeekdayFromDate("20080818","thursday")

    NextWeekdayFromDate(mylink.mysourcedate,"thu")NthWeekdayFromDate

    Returnsthedateofthespecifieddayoftheweekoffsetbythespecifiednumberofweeksfromthesourcedate.Thedayoftheweekisspecifiedasthefullname,forexample,thursday,orathreeletterabbreviation,forexample,thu.Theoffsetcanbepositive,negative,orzero.

    Input:basedate(date),day_of_week(string),week_offset(int32)

    Output:date Examples.Ifmylink.mydatecontainsthedate20090818,thenthetwo

    followingfunctionsareequivalent,andreturnthevalue20090827:

  • NthWeekdayFromDate("20090818","thursday",1)NthWeekdayFromDate(mylink.mydate,"thu",1)Ifmylink.mydatecontainsthedate20090818,thenthetwofollowingfunctionsareequivalent,andreturnthevalue20090806:NthWeekdayFromDate("20090818","thursday",2)NthWeekdayFromDate(mylink.mydate,"thu",2)

    PreviousWeekdayFromDateReturnsthedateofthespecifieddayoftheweekmostrecentbeforethesourcedate.Thedayoftheweekisspecifiedasthefullname,forexample,thursday,orathreeletterabbreviation,forexample,thu.

    Input:sourcedate,day_of_week(string)

    Output:date Examples.Ifmylink.mysourcedatecontainsthedate20080818,thenthe

    twofollowingfunctionsareequivalent,andreturnthevalue20080814: PreviousWeekdayFromDate("20080818","thursday")

    PreviousWeekdayFromDate(mylink.mysourcedate,"thu")SecondsFromTime

    Returnsthesecondsportionofatime. Input:time

    Output:seconds(dfloat) Examples.Ifmylink.mytimecontainsthetime22:30:52,thenthetwo

    followingfunctionsareequivalent,andreturnthevalue52: SecondsFromTime("22:30:52")

    SecondsFromTime(mylink.mytime)SecondsSinceFromTimestamp

    Returnsthenumberofsecondsbetweentwotimestamps. Input:timestamp,timestamp_base

    Output:seconds(dfloat) Examples.Ifmylink.mytimestampcontainsthetimestamp20080818

    22:30:52,andmylink.mytimestamp_basecontainsthetimestamp2008081922:30:52,thenthetwofollowingfunctionsareequivalent,andreturnthevalue86400:

    SecondsSinceFromTimestamp("2008081822:30:52","2008081922:30:52")SecondsSinceFromTimestamp(mylink.mytimestamp,mylink.mytimestamp_base)

    TimeDateReturnsthesystemtimeanddateasaformattedstring.

    Input:

    Output:systemtimeanddate(string) Examples.Ifthejobwasrunat4.21pmonJune20th2008,thenthe

  • followingfunctionreturnsthestring"16:21:4820Jun2008".TimeDate()

    TimeFromComponentsReturnsatimefromthegivenhours,minutes,secondsandmicrosecondsgivenasfourseparatevalues.

    Input:hours(int32),minutes(int32),seconds(int32),microseconds(int32)

    Output:time Examples.Ifmylink.hourcolcontainsthevalue10,mylink.mincol

    containsthevalue12,mylink.seccolcontainsthevalue2,andmylink.mseccolcontains0,thenthetwofollowingfunctionsareequivalent,andreturnthetime10:12:02.0:

    TimeFromComponents(10,12,2,0)TimeFromComponents(mylink.hourcol,mylink.mincol,mylink.seccol,mylink.mseccol)

    TimeFromMidnightSecondsReturnsthetimegiventhenumberofsecondssincemidnight.

    Input:seconds(dfloat)

    Output:time Examples.Ifmylink.mymidnightsecondscontainsthevalue240,thenthe

    twofollowingfunctionsareequivalent,andreturnthevalue00:04:00: TimeFromMidnightSeconds("240")

    TimeFromMidnightSeconds(mylink.mymidnightseconds)TimeOffsetByComponents

    Returnsthegiventime,withoffsetsappliedfromthegivenhouroffset,minuteoffset,andsecondoffset,eachgivenasseparatevalues.Thesecondsoffsetcanincludepartialseconds.

    Input:basetime(time),hour_offset(int32),minute_offset(int32),second_offset(dfloat)

    Output:time Examples.Ifmylink.basetimecontains14:05:29andmylink.houros

    containsthevalue2,mylink.minoscontainsthevalue0,mylink.secoscontainsthevalue20,thenthetwofollowingfunctionsareequivalent,andreturnthetime16:05:49.

    TimeOffsetByComponents("14:05:29",2,0,20)TimeOffsetByComponents(mylink.basetime,mylink.houros,mylink.minos,mylink.secos)

    TimeOffsetBySecondsReturnsthegiventime,withoffsetsappliedfromthegivensecondsoffset.Thesecondsoffsetcanincludepartialseconds.

    Input:basetime(time),second_offset(dfloat)

  • Output:time Examples.Ifmylink.basetimecontains14:05:29.30andmylink.secos

    containsthevalue2.5,thenthetwofollowingfunctionsareequivalent,andreturnthetime14:05:31.80:

    TimeOffsetByComponents("14:05:29.30",2.5)TimeOffsetByComponents(mylink.basetime,mylink.secos)

    TimestampFromDateTimeReturnsatimestampformthegivendateandtime.

    Input:datetime

    Output:timestamp Examples.Ifmylink.mydatecontainsthedate20080818and

    mylink.mytimecontainsthetime22:30:52,thenthetwofollowingfunctionsareequivalent,andreturnthetimestamp2008081822:30:52:

    TimestampFromDateTime("20080818","22:30:52")TimestampFromDateTime(mylink.mydate,mylink.mytime)

    TimestampFromSecondsSinceReturnsatimestampderivedfromthenumberofsecondsfromthebasetimestamp.

    Input:seconds(dfloat),[base_timestamp]

    Output:timestamp Examples.Ifmylink.mysecondscontainsthevalue2563and

    mylink.timestamp_basecontainsthetimestamp2008081822:30:52,thenthetwofollowingfunctionsareequivalent,andreturnthetimestamp2008081823:13:35:

    TimestampFromSecondsSince("2563","2008081822:30:52")TimestampFromSecondsSince(mylink.myseconds,mylink.timestamp_base)

    TimestampFromTimetReturnsatimestampfromthegivenUNIXtime_tvalue.

    Input:timet(int32)

    Output:timestamp Examples.Ifmylink.mytimetcontainsthevalue1234567890,thenthe

    twofollowingfunctionsareequivalent,andreturnthetimestamp2009021323:31:30:

    TimestampFromTimet("1234567890")TimestampFromTimet(mylink.mytimet)

    TimestampOffsetByComponentsReturnsthegiventimestamp,withoffsetsappliedfromthegivenyearoffset,monthoffset,dayoffset,houroffset,minuteoffset,andsecondoffset,eachgivenasseparatevalues.Thesecondsoffsetcanincludepartialseconds.

    Input:basetimestamp(timestamp),year_offset(int32),month_offset

  • (int32),dayofmonth_offset(int32),hour_offset(int32),minute_offset(int32),second_offset(dfloat)

    Output:timestamp Examples.Ifmylink.basetimestampcontains2009081814:05:29and

    mylink.yearoscontains0,mylink.monthoscontainsthevalue2,mylink.dayoscontainsthevalue4,mylink.houroscontainsthevalue2,mylink.minoscontainsthevalue0,mylink.secoscontainsthevalue20,thenthetwofollowingfunctionsareequivalent,andreturnthetimestamp2009101416:05:49.

    TimestampOffsetByComponents("2009081814:05:29",0,2,4,2,0,20)

    TimestampOffsetByComponents(mylink.basetimestamp,mylink.houros,mylink.minos,mylink.secos)

    TimestampOffsetBySecondsReturnsthegiventimestamp,withoffsetsappliedfromthegivensecondsoffset.Thesecondsoffsetcanincludepartialseconds.

    Input:basetimestamp(timestamp),second_offset(dfloat)

    Output:timestamp Examples.Ifmylink.basetimestampcontains2009081814:05:29and

    mylink.secoscontainsthevalue32760,thenthetwofollowingfunctionsareequivalent,andreturnthetimestamp2009081823:11:29:

    TimeOffsetBySeconds("2009081814:05:29",32760) TimeOffsetBySeconds

    (mylink.basetimestamp,mylink.secos)TimetFromTimestamp

    ReturnsaUNIXtime_tvaluefromthegiventimestamp. Input:timestamp

    Output:timet(int32) Examples.Ifmylink.mytimestampcontainsthevalue20090213

    23:31:30,thenthetwofollowingfunctionsareequivalent,andreturnthevalue1234567890:

    TimestampFromTimet("2009021323:31:30")TimestampFromTimet(mylink.mytimestamp)

    WeekdayFromDateReturnsthedaynumberoftheweekfromthegivendate.Origin_dayoptionallyspecifiesthedayregardedasthefirstintheweekandisSundaybydefault.

    Input:date,[origin_day]

    Output:day(int8) Examples.Ifmylink.mydatecontainsthedate20080818,thenthetwo

    followingfunctionsareequivalent,andreturnthevalue1:

  • WeekdayFromDate("20080818")WeekdayFromDate(mylink.mydate)Ifmylink.mydatecontainsthedate20080818,andmylink.origin_daycontainssaturday,thenthetwofollowingfunctionsareequivalent,andreturnthevalue2:WeekdayFromDate("20080818","saturday")WeekdayFromDate(mylink.mydate,mylink.origin_day)

    YeardayFromDateReturnsthedaynumberintheyearfromthegivendate.

    Input:date

    Output:day(int16) Examples.Ifmylink.mydatecontainsthedate20080818,thenthetwo

    followingfunctionsareequivalent,andreturnthevalue231: YeardayFromDate("20080818")

    YeardayFromDate(mylink.mydate)YearFromDate

    Returnstheyearfromthegivendate. Input:date

    Output:year(int16) Examples.Ifmylink.mydatecontainsthedate20080818,thenthetwo

    followingfunctionsareequivalent,andreturnthevalue2008: YearFromDate("20080818")

    YearFromDate(mylink.mydate)YearweekFromDate

    Returnstheweeknumberintheyearfromthegivendate Input:date

    Output:week(int16) Examples.Ifmylink.mydatecontainsthedate20080818,thenthetwo

    followingfunctionsareequivalent,andreturnthevalue33: YearweekFromDate("20080818")

    YearweekFromDate(mylink.mydate)

    LogicalfunctionsThelogicalfunctionsperformbitoperations.ThelogicalfunctionsareintheLogicalcategoryoftheexpressioneditor.Squarebracketsindicateanargumentisoptional.TheexamplesshowthefunctionasitappearsinaDerivationfieldintheTransformerstage.BitAnd

    ReturnsthebitwiseANDofthetwointegerarguments. Input:number1(uint64),number2(uint64)

  • Output:number(uint64) Examples.Ifmylink.mynumber1containsthenumber352and

    mylink.mynumber2containsthenumber400,thenthefollowingtwofunctionsareequivalent,andreturnthevalue256:

    BitAnd(352,400)BitAnd(mylink.mynumber1,mylink.mynumber2)

    BitCompressReturnstheintegermadefromthestringargument,whichcontainsabinaryrepresentationof"1"sand"0"s.

    Input:string

    Output:number(uint64) Examples.Ifmylink.mynumber1containsthestring"0101100000",then

    thefollowingtwofunctionsareequivalent,andreturnthenumber352. BitExpand("0101100000")

    BitExpand(mylink.mynumber)BitExpand

    Returnsastringcontainingthebinaryrepresentationin"1"sand"0"softhegiveninteger.

    Input:number(uint64)

    Output:string Examples.Ifmylink.mynumber1containsthenumber352,thenthe

    followingtwofunctionsareequivalent,andreturnthestring"0101100000".

    BitExpand(352)BitExpand(mylink.mynumber)

    BitOrReturnsthebitwiseORofthetwointegerarguments.

    Input:number1(uint64),number2(uint64)

    Output:number(uint64) Examples.Ifmylink.mynumber1containsthenumber352and

    mylink.mynumber2containsthenumber400,thenthefollowingtwofunctionsareequivalent,andreturnthevalue496:

    BitOr(352,400)BitOr(mylink.mynumber1,mylink.mynumber2)

    BitXOrReturnsthebitwiseExclusiveORofthetwointegerarguments.

    Input:number1(uint64),number2(uint64)

    Output:number(uint64) Examples.Ifmylink.mynumber1containsthenumber352and

    mylink.mynumber2containsthenumber400,thenthefollowingtwo

  • functionsareequivalent,andreturnthevalue240: BitXOr(352,400)

    BitXOr(mylink.mynumber1,mylink.mynumber2)Not

    Returnsthecomplementofthelogicalvalueofanexpression.Ifthevalueofexpressionistrue,theNotfunctionreturnsavalueoffalse(0).Ifthevalueofexpressionisfalse,theNOTfunctionreturnsavalueoftrue(1).Anumericexpressionthatevaluatesto0isalogicalvalueoffalse.Anumericexpressionthatevaluatestoanythingelse,otherthanthenullvalue,isalogicaltrue.Anemptystringislogicallyfalse.Allotherstringexpressions,includingstringsthatincludeanemptystring,spaces,orthenumber0andspaces,arelogicallytrue.

    Input:expression

    Output:complement(int8) Examples.Ifmylink.myexpressioncontainstheexpression55,thenthe

    followingtwofunctionsareequivalent,andreturnthevalue1: Not(55) Not(mylink.myexpression)

    Ifmylink.myexpressioncontainstheexpression5+5,thenthefollowingtwofunctionsareequivalent,andreturnthevalue0:

    Not(5+5) Not(mylink.myexpression)

    SetBitReturnsanintegerwithspecificbitssettoaspecificstate,whereorigfieldistheinputvaluetoperformtheactionon,bitlistisastringcontainingalistofcommaseparatedbitnumberstosetthestateof,andbitstateiseither1or0,indicatingwhichstatetosetthosebits.

    Input:origfield(uint64),bitlist(string),bitstate(uint8)

    Output:number(uint64) Examples.Ifmylink.origfieldcontainsthenumber352,mylink.bitlist

    containsthelist"2,4,8",andmylink.bitstatecontainsthevalue1,thenthefollowingtwofunctionsareequivalent,andreturnthevalue494:

    SetBit(356,"2,4,8",1)SetBit(mylink.origfield,mylink.bitlist,mylink.bitstate)

    MathematicalfunctionsThemathematicalfunctionsperformmathematicaloperations.ThemathematicalfunctionsareintheMathematicalcategoryoftheexpressioneditor.Squarebracketsindicateanargumentisoptional.TheexamplesshowthefunctionasitappearsinaDerivationfieldintheTransformerstage.Abs

    Returnstheabsolutevalueofanynumericexpression.Theabsolutevalueofan

  • expressionisitsunsignedmagnitude. Input:numeric_expression(int32)

    Output:result(dfloat) Examples.Ifmylink.number1containsthenumber12and

    mylink.number2containsthenumber34,thenthefollowingtwofunctionsareequivalent,andreturnthenumber22:

    Abs(1234)Abs(mylink.mynumber1mylink.mynumber2)Ifmylink.number1containsthenumber34andmylink.number2containsthenumber12,thenthefollowingtwofunctionsareequivalent,andreturnthenumber22:Abs(3412)Abs(mylink.mynumber1mylink.mynumber2)

    AcosCalculatesthetrigonometricarccosineofanexpression.Theexpressionmustbeanumericvalue.Theresultisexpressedinradians.

    Input:numeric_expression(dfloat)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber0.707106781,thenthe

    followingtwofunctionsareequivalent,andreturnthevalue0.785398: Acos(0.707106781)

    Acos(mylink.mynumber)Asin

    Calculatesthetrigonometricarcsineofanexpression.Theexpressionmustbeanumericvalue.Theresultisexpressedinradians.

    Input:numeric_expression(dfloat)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber0.707106781,thenthe

    followingtwofunctionsareequivalent,andreturnthevalue0.785398: Asin(0.707106781)

    Asin(mylink.mynumber)Atan

    Calculatesthetrigonometricarctangentofanexpression.Theexpressionmustbeanumericvalue.Theresultisexpressedinradians.

    Input:numeric_expression(dfloat)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber135,thenthefollowing

    twofunctionsareequivalent,andreturnthevalue1.56339,whichistheanglethathasanarctangentof135:

    Atan(135)

  • Atan(mylink.mynumber)Ceil

    Calculatesthesmallestintegervaluegreaterthanorequaltothegivendecimalvalue.

    Input:number(dfloat)

    Output:result(int32) Examples.Ifmylink.numbercontainsthenumber2355.66,thenthe

    followingtwofunctionsareequivalent,andreturnthevalue2356: Ceil(2355.66)

    Ceil(mylink.mynumber)Cos

    Calculatesthetrigonometriccosineofanexpression.Theexpressionmustbeanumericvalue.Theexpressionmustproduceanumericvaluewhichistheangleinradians.

    Input:radians(dfloat)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber0.785398,thenthe

    followingtwofunctionsareequivalent,andreturnthevalue0.7071: Cos(0.785398)

    Cos(mylink.mynumber)Cosh

    Calculatesthehyperboliccosineofanexpression.Theexpressionmustbeanumericvalue.

    Input:number(dfloat)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber2,thenthefollowing

    twofunctionsareequivalent,andreturnthevalue3.7622: Cosh(2)

    Cosh(mylink.mynumber)Div

    Outputsthewholepartoftherealdivisionoftworealnumbers(dividend,divisor).

    Input:dividend(dfloat),divisor(dfloat)

    Output:result(dfloat) Examples.Ifmylink.dividendcontainsthenumber100,and

    mylink.divisorcontainsthenumber25,thenthefollowingtwofunctionsareequivalent,andreturnthevalue4:

    Div(100,25)Div(mylink.dividend,mylink.divisor)

    ExpCalculatestheresultofbase'e'raisedtothepowerdesignatedbythevalueofthe

  • expression.Thevalueof'e'isapproximately2.71828.Theexpressionmustevaluatetoanumericvalue.

    Input:number(dfloat)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber5,thenthefollowing

    twofunctionsareequivalent,andreturnthevalue54.5982: Exp(51)

    Exp(mylink.number1)Fabs

    Calculatestheabsolutevalueofthegivenfloatvalue. Input:number(dfloat)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber26.53,thenthe

    followingtwofunctionsareequivalent,andreturnthevalue26.53: Fabs(26.53)

    Fabs(mylink.number)Floor

    Calculatesthelargestintegervaluelessthanorequaltothegivendecimalvalue. Input:number(dfloat)

    Output:result(int32) Examples.Ifmylink.numbercontainsthenumber203.25,thenthe

    followingtwofunctionsareequivalent,andreturnthevalue203: Floor(203.25)

    Floor(mylink.number)Ldexp

    Returnsadfloatvaluefrommultiplyingthemantissaby2raisedtothepoweroftheexponent.

    Input:mantissa(dfloat),exponent(int32)

    Output:result(dfloat) Examples.Ifmylink.mantissacontainsthenumber2,and

    mylink.exponentcontainsthenumber3,thenthefollowingtwofunctionsareequivalent,andreturnthevalue16:

    Floor(2,3)Floor(mylink.mantissa,mylink.exponent)

    LlabsCalculatestheabsolutevalueofthegivenintegervalue.

    Input:number(integer)

    Output:result(unsignedinteger) Examples.Ifmylink.numbercontainsthenumber26,thenthefollowing

  • twofunctionsareequivalent,andreturnthevalue26: Llabs(26)

    Llabs(mylink.number)Ln

    Calculatesthenaturallogarithmofanexpressioninbase'e'.Thevalueof'e'isapproximately2.71828.Theexpressionmustevaluatetoanumericvaluegreaterthan0.

    Input:number(dfloat)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber6,thenthefollowing

    twofunctionsareequivalent,andreturnthevalue1.79176: Ln(6)

    Ln(mylink.number)Log10

    Returnsthelogtothebase10ofthegivenvalue Input:number(dfloat)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber6,thenthefollowing

    twofunctionsareequivalent,andreturnthevalue0.778151: Log10(6)

    Log10(mylink.number)Max

    Returnsthegreaterofthetwoargumentvalues. Input:number1(int32),number2(int32)

    Output:result(int32) Examples.Ifmylink.number1containsthenumber6,and

    mylink.number1containsthenumber101,thenthefollowingtwofunctionsareequivalent,andreturnthevalue101:

    Max(6,101)Max(mylink.number1,mylink.number2)

    MinReturnsthelowerofthetwoargumentvalues.

    Input:number1(int32),number2(int32)

    Output:result(int32) Examples.Ifmylink.number1containsthenumber6,and

    mylink.number1containsthenumber101,thenthefollowingtwofunctionsareequivalent,andreturnthevalue6:

    Min(6,101)Min(mylink.number1,mylink.number2)

    Mod

  • Calculatesthemodulo(theremainder)oftwoexpressions(dividend,divisor). Input:dividend(int32),divisor(int32)

    Output:result(int32) Examples.Ifmylink.dividendcontainsthenumber115,and

    mylink.divisorcontainsthenumber25,thenthefollowingtwofunctionsareequivalent,andreturnthevalue15:

    Mod(115,25)Mod(mylink.dividend,mylink.divisor)

    NegNegatesanumber.

    Input:number(dfloat)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber123,thenthefollowing

    twofunctionsareequivalent,andreturnthevalue123: Neg(123)

    Neg(mylink.number)Pwr

    Calculatesthevalueofanexpressionwhenraisedtoaspecifiedpower(expression,power).

    Input:expression(dfloat),power(dfloat)

    Output:result(dfloat) Examples.Ifmylink.expressioncontainsthenumber2,andmylink.power

    containsthenumber3,thenthefollowingtwofunctionsareequivalent,andreturnthevalue8:

    Pwr(2,3)Pwr(mylink.expression,mylink.power)

    RandReturnapsuedorandomintegerbetween0and2321

    Input:

    Output:result(uint32) Examples.Usethisfunctiontoaddacolumntoyouroutputcontaininga

    randomnumber:Rand()

    RandomReturnsarandomnumberbetween0and2321

    Input:

    Output:result(uint32) Examples.Usethisfunctiontoaddacolumntoyouroutputcontaininga

    randomnumber:

  • Random()Sin

    Calculatesthetrigonometricsineofanexpression.Theexpressionmustbeanumericvalue.Theexpressionmustproduceanumericvaluewhichistheangleinradians.

    Input:radians(dfloat)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber0.785398,thenthe

    followingtwofunctionsareequivalent,andreturnthevalue0.7071: Sin(0.785398)

    Sin(mylink.mynumber)Sinh

    Calculatesthehyperbolicsineofanexpression.Theexpressionmustbeanumericvalue.

    Input:number(dfloat)

    Output:result(dfloat) Examples:Ifmylink.numbercontainsthenumber2,thenthefollowing

    twofunctionsareequivalent,andreturnthevalue3.62686: Sinh(2)

    Sinh(mylink.mynumber)Sqrt

    Calculatesthesquarerootofanumber. Input:number(dfloat)

    Output:result(dfloat) Examples:Ifmylink.numbercontainsthenumber450,thenthefollowing

    twofunctionsareequivalent,andreturnthevalue21.2132: Sqrt(450)

    Sqrt(mylink.mynumber)Tan

    Calculatesthetrigonometrictangentofanexpression.Theexpressionmustproduceanumericvaluewhichistheangleinradians.

    Input:radians(dfloat)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber0.7853981,thenthe

    followingtwofunctionsareequivalent,andreturnthevalue0.7071: Tan(0.7853981)

    Tan(mylink.mynumber)Tanh

    Calculatesthehyperbolictangentofanexpression.Theexpressionmustbeanumericvalue.

  • Input:number(dfloat)

    Output:result(dfloat) Examples:Ifmylink.numbercontainsthenumber2,thenthefollowing

    twofunctionsareequivalent,andreturnthevalue0.964028: Tanh(2)

    Tanh(mylink.mynumber)

    NullhandlingfunctionsYoucanusethenullhandlingfunctionsintheTransformerstagetohandlenullsinderivations.Ifyouuseinputcolumnsinanoutputcolumnexpression,anullvalueinanyinputcolumncausesanulltobewrittentotheoutputcolumn.Youcan,however,usethenullhandlingfunctionstohandlenullsexplicitly.ThefollowingfunctionsareavailableintheNullHandlingcategory.Squarebracketsindicateanargumentisoptional.TheexamplesshowthefunctionasitappearsinaDerivationfieldintheTransformerstage.IsNotNull

    Returnstruewhenanexpressiondoesnotevaluatetothenullvalue. Input:any

    Output:true/false(int8) Examples.IftheDerivationfieldforanoutputcolumncontainedthe

    followingcode,thentheTransformerstagechecksiftheinputcolumnnamedmylink.mycolumncontainsanullvalue.Iftheinputcolumndoesnotcontainanull,theoutputcolumncontainsthevalueoftheinputcolumn.Iftheinputcolumndoescontainanull,thentheoutputcolumncontainsthestringNULL.IfIsNotNull(mylink.mycolumn)Thenmylink.mycolumnElse"NULL"

    IsNullReturnstruewhenanexpressionevaluatestothenullvalue.

    Input:any

    Output:true/false(int8) Examples.IftheDerivationfieldforanoutputcolumncontainedthe

    followingcode,thentheTransformerstagechecksiftheinputcolumnnamedmylink.mycolumncontainsanullvalue.Iftheinputcolumncontainsanull,theoutputcolumncontainsthestringNULL.Iftheinputcolumndoesnotcontainanull,thentheoutputcolumncontainsthevalueoftheinputcolumn.IfIsNull(mylink.mycolumn)Then"NULL"Elsemylink.mycolumn

    NullToEmpty

  • Returnsanemptystringiftheinputcolumnisnull,otherwisereturnstheinputcolumnvalue.

    Input:inputcolumn

    Output:inputcolumnvalueoremptystring Examples.IftheDerivationfieldforanoutputcolumncontainedthe

    followingcode,thentheTransformerstagechecksiftheinputcolumnnamedmylink.mycolumncontainsanullvalue.Iftheinputcolumncontainsanull,theoutputcolumncontainsanemptystring.Iftheinputcolumndoescontainanull,thentheoutputcolumncontainsthevaluefromtheinputcolumn.NullToEmpty(mylink.mycolumn)

    NullToZeroReturnszeroiftheinputcolumnisnull,otherwisereturnstheinputcolumnvalue.

    Input:inputcolumn

    Output:inputcolumnvalueorzero Examples.IftheDerivationfieldforanoutputcolumncontainedthe

    followingcode,thentheTransformerstagechecksiftheinputcolumnnamedmylink.mycolumncontainsanullvalue.Iftheinputcolumncontainsanull,theoutputcolumncontainszero.Iftheinputcolumndoescontainanull,thentheoutputcolumncontainsthevaluefromtheinputcolumn.NullToZeroy(mylink.mycolumn)

    NullToValueReturnsthespecifiedvalueiftheinputcolumnisnull,otherwisereturnstheinputcolumnvalue.

    Input:inputcolumn,value

    Output:inputcolumnvalueorvalue Examples.IftheDerivationfieldforanoutputcolumncontainedthe

    followingcode,thentheTransformerstagechecksiftheinputcolumnnamedmylink.mycolumncontainsanullvalue.Iftheinputcolumncontainsanull,theoutputcolumncontains42.Iftheinputcolumndoescontainanull,thentheoutputcolumncontainsthevaluefromtheinputcolumn.NullToValue(mylink.mycolumn,42)

    SetNullAssignsanullvaluetothetargetcolumn.

    Input:

    Output: Examples.IftheDerivationfieldforanoutputcolumncontainedthe

    followingcode,thentheTransformerstagesetstheoutputcolumntonull:

  • setnull()

    NumberfunctionsUsethenumberfunctionstoextractthemantissafromadecimalorfloatingpointnumber.TheNumbercategoryintheexpressioneditoralsocontainsthetypecastingfunctions,whichyoucanusetocastnumbersasdouble,float,orintegerdatatypes.Squarebracketsindicateanargumentisoptional.TheexamplesshowthefunctionasitappearsinaDerivationfieldintheTransformerstage.Thetypecastingfunctionshelpyouwhenyouperformmathematicalcalculationsusingnumericfields.Forexample,ifyouhaveacalculationusinganoutputcolumnoftypefloatderivedfromaninputcolumnoftypeintegerinaParallelTransformerstagetheresultisderivedasanintegerregardlessofitsfloattype.Ifyouwantanonintegralresultforacalculationusingintegraloperands,youcanusethetypecastingfunctionstocasttheintegeroperandsintononintegraloperands.AsDouble

    Treatthegivennumberasadouble. Input:number

    Output:number(double) Examples.Inthefollowingexpression,theinputcolumnmynumber

    containsaninteger,butthefunctionoutputsadouble.Ifmylink.mynumbercontainsthevalue56,thenthefollowingtwofunctionsareequivalent,andreturnthevalue1.29629629629629619E+01:

    AsDouble(56/4.32)AsDouble(mylink.mynumber/4.32)

    AsFloatTreatthegivennumberasafloat.

    Input:number

    Output:number(float) Examples.Inthefollowingexpression,theinputcolumnmynumber

    containsaninteger,butthefunctionoutputsafloat.Ifmylink.mynumbercontainsthevalue56,thenthefollowingtwofunctionsareequivalent,andreturnthevalue1.29629629629629619E+01:

    AsFloat(56/4.32)AsFloat(mylink.mynumber/4.32)

    AsIntegerTreatthegivennumberasaninteger.

    Input:number

    Output:number(integer) Examples.Inthefollowingexpression,theinputcolumnmynumber

    containsadouble,butthefunctionisoutputaninteger.If

  • mylink.mynumbercontainsthevalue56,thenthefollowingtwofunctionsareequivalent,andreturnthevalue12:

    AsInteger(56/4.32)AsInteger(mylink.mynumber/4.32)

    MantissaFromDecimalReturnsthemantissafromthegivendecimal.

    Input:number(decimal)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber243.7675,thenthe

    followingtwofunctionsareequivalent,andreturnthevalue7675: MantissaFromDecimal(243.7675)

    MantissaFromDecimal(mylink.mynumber)MantissaFromDFloat

    Returnsthemantissafromthegivendfloat. Input:number(dfloat)

    Output:result(dfloat) Examples.Ifmylink.numbercontainsthenumber

    1.234412000000000010E+4,thenthefollowingfunctionreturnsthevalue1:MantissaFromDFloat(mylink.mynumber)

    RawfunctionsUsetheRawfunctiontoobtainthelengthofthedatainacolumncontainingrawdata.ThefunctionisintheRawcategory.TheexamplesshowthefunctionasitappearsinaDerivationfieldintheTransformerstage.RawLength

    Returnsthelengthofarawstring. Input:inputstring(raw)

    Output:result(int32) Examples.Ifmylink.rawdatacontainstherawdatafromabitmap,then

    thefollowingfunctionreturnsthesizeofthebitmapinbytes:RawLength(mylink.rawdata)

    StringfunctionsUsethestringfunctionstomanipulatestrings.ThefollowingfunctionsareintheStringcategoryoftheexpressioneditor.Squarebracketsindicateanargumentisoptional.TheexamplesshowthefunctionasitappearsinaDerivationfieldintheTransformerstage.

  • AlNumCheckswhetherthegivenstringcontainsonlyalphanumericcharacters.

    Input:string(string)

    Output:true/false(int8) Examples.Ifmylink.mystring1containsthestring"OED_75_9*E",then

    thefollowingfunctionwouldreturnthevalue1(false).AlNum(mylink.mystring1)Ifmylink.mystring2containsthestring"12redroses",thenthefollowingfunctionwouldreturnthevalue1(true).AlNum(mylink.mystring2)

    AlphaCheckswhetherthegivenstringcontainsonlyalphabeticcharacters.

    Input:string(string)

    Output:true/false(int8) Examples.Ifmylink.mystring1containsthestring"12redroses",thenthe

    followingfunctionwouldreturnthevalue1(false).Alpha(mylink.mystring1)Ifmylink.mystring2containsthestring"twelveredroses",thenthefollowingfunctionwouldreturnthevalue1(true).Alpha(mylink.mystring2)

    CompactWhiteSpaceReturnthestringafterreducingallconsecutivewhitespacetoasinglespace.

    Input:string(string)

    Output:result(string) Examples.Ifmylink.mystringcontainsthestring"toomanyspaces",

    thenthefollowingfunctionreturnsthestring"toomanyspaces":CompactWhiteSpace(mylink.mystring)

    CompareComparestwostringsforsorting.Thecomparisoncanbeleftjustified(thedefault)orrightjustified.Arightjustifiedcomparisoncomparesnumericsubstringswithinthespecifiedstringsasnumbers.Thenumericstringsmustoccuratthesamecharacterpositionineachstring.Forexample,arightjustifiedcomparisonofthestringsAB100andAB99indicatesthatAB100isgreaterthanAB99since100isgreaterthan99.ArightjustifiedcomparisonofthestringsAC99andAB100indicatesthatAC99isgreatersinceCisgreaterthanB.

    Input:string1(string),string2(string),[justification(LorR)]

    Output:result(int8),canbe1forstring1islessthanstring2,0forbothstringsarethesame,1forstring1isgreaterthanstring2.

    Examples.Ifmylink.mystring1containsthestring"AB99"and

  • mylink.mystring2containsthestring"AB100",thenthefollowingfunctionreturnstheresult1.Compare(mylink.mystring1,mylink.mystring2,L)Ifmylink.mystring1containsthestring"AB99"andmylink.mystring2containsthestring"AB100",thenthefollowingfunctionreturnstheresult1.Compare(mylink.mystring1,mylink.mystring2,R)

    CompareNoCaseComparestwostringsforsorting,ignoringtheircase.

    Input:string1(string),string2(string)

    Output:result(int8),canbe1forstring1islessthanstring2,0forbothstringsarethesame,1forstring1isgreaterthanstring2.

    Examples.Ifmylink.mystring1containsthestring"ChocolateCake"andmylink.mystring2containsthestring"chocolatecake",thenthefollowingfunctionreturnstheresult1.ComparNoCase(mylink.mystring1,mylink.mystring2)

    CompareNumComparesthefirstncharactersoftwostrings.

    Input:string1(string),string2(string),length(int16)

    Output:result(int8),canbe1forstring1islessthanstring2,0forbothstringsarethesame,1forstring1isgreaterthanstring2.

    Examples.Ifmylink.mystring1containsthestring"Chocolate"andmylink.mystring2containsthestring"ChoccyTreat",thenthefollowingfunctionreturnstheresult1.ComparNum(mylink.mystring1,mylink.mystring2,4)

    CompareNumNoCaseComparesthefirstncharactersoftwostrings,ignoringtheircase.

    Input:string1(string),string2(string),length(int16)

    Output:result(int8),canbe1forstring1islessthanstring2,0forbothstringsarethesame,1forstring1isgreaterthanstring2.

    Examples.Ifmylink.mystring1containsthestring"chocolate"andmylink.mystring2containsthestring"ChoccyTreat",thenthefollowingfunctionreturnstheresult1.ComparNumNoCase(mylink.mystring1,mylink.mystring2,4)

    ConvertConvertscharactersinthestringdesignatedinexpression.Convertsthecharactersspecifiedinfromlisttothecharactersspecifiedintolist.

    Input:fromlist(string),tolist(string),expression(string)

    Output:result(string) Examples.Ifmylink.mystring1containsthestring"NOWISTHE

  • TIME",thenthefollowingfunctionreturnsthestring"NOWYSXHEXYME".Convert("TI","XY",mylink.mystring1)

    CountCountsthenumberoftimesasubstringoccursinastring.

    Input:string(string),substring(string)

    Output:result(int32) Examples.Ifmylink.mystring1containsthestring"chocolatedrops,

    chocolateicecream,chocolatebars",thenthefollowingfunctionreturns3.Count(mylink.mystring1,"choc")

    DcountCountsthenumberofdelimitedfieldsinastring.

    Input:string(string),delimiter(string)

    Output:result(int32) Examples.Ifmylink.mystring1containsthestring"chocolatedrops,

    chocolateicecream,chocolatebars",thenthefollowingfunctionreturns3.Dcount(mylink.mystring1,",")

    DownCaseChangesalluppercaselettersinastringtolowercase.

    Input:string(string)

    Output:result(string) Examples.Ifmylink.mystring1containsthestring"CaMelcAsE",then

    thefollowingfunctionreturnsthestring"camelcase".DownCase(mylink.mystring1)

    DQuoteEnclosesastringindoublequotationmarks.

    Input:string(string)

    Output:result(string) Examples.Ifmylink.mystring1containsthestringneedsquotes,thenthe

    followingfunctionreturnsthestring"needsquotes".DQuote(mylink.mystring1)

    FieldReturnsoneormoresubstringslocatedbetweenspecifieddelimitersinastring.Theargumentoccurrencespecifieswhichoccurrenceofthedelimiteristobeusedasaterminator.Theargumentnumberoptionallyspecifieshowmanysubstringstoreturn.

    Input:string(string),delimiter(string),occurrence(int32),[number

  • (int32)] Output:result(string) Examples.Ifmylink.mystring1containsthestring"chocolatedrops,

    chocolateicecream,chocolatebars,chocolatedippers",thenthefollowingfunctionreturnsthestring"chocolateicecream".Field(mylink.mystring1,",",2)Ifmylink.mystring1containsthestring"chocolatedrops,chocolateicecream,chocolatebars,chocolatedippers",thenthefollowingfunctionreturnsthestring"chocolateicecream,chocolatebars".Field(mylink.mystring1,",",2,2)

    IndexFindsthestartingcharacterpositionofasubstring.Theargumentoccurrencespecifieswhichoccurrenceofthesubstringistobelocated.

    Input:string(string)substring(string)occurrence(int32)

    Output:result(int32) Examples.Ifmylink.mystring1containsthestring"chocolatedrops,

    chocolateicecream,chocolatebars,chocolatedippers",thenthefollowingfunctionreturnsthevalue18.Index(mylink.mystring1,"chocolate",2)

    LeftReturnstheleftmostncharactersofastring.

    Input:string(string)number(int32)

    Output:result(string) Examples.Ifmylink.mystring1containsthestring"chocolatedrops,

    chocolateicecream,chocolatebars,chocolatedippers",thenthefollowingfunctionreturnsthestring"chocolate".Left(mylink.mystring1,9)

    LenReturnsthelengthofastringincharacters.

    Input:string(string)

    Output:result(int32) Examples.Ifmylink.mystring1containsthestring"chocolate",thenthe

    followingfunctionreturnsthevalue9.Len(mylink.mystring1)

    NumReturns1ifstringcanbeconvertedtoanumber,or0otherwise.

    Input:string(string)

    Output:result(int32) Examples.Ifmylink.mystring1containsthestring"22",thenthe

  • followingfunctionreturnsthevalue1.Num(mylink.mystring1)Ifmylink.mystring1containsthestring"twentytwo",thenthefollowingfunctionreturnsthevalue0.Num(mylink.mystring1)

    PadStringReturnthestringpaddedwiththespecifiednumberofpadcharacters.

    Input:string(string)padstring(string)padlength(int32)

    Output:result(string) Examples.IIfmylink.mystring1containsthestring"AB175",thenthe

    followingfunctionreturnsthestring"AB17500000".PadString(mylink.mystring1,"0",5)

    RightReturnstherightmostncharactersofastring.

    Input:string(string)number(int32)

    Output:result(string) Examples.Ifmylink.mystring1containsthestring"chocolatedrops,

    chocolateicecream,chocolatebars,chocolatedippers",thenthefollowingfunctionreturnsthestring"dippers".Right(mylink.mystring1,7)

    SoundexReturnsacodewhichidentifiesasetofwordsthatare(roughly)phoneticallyalikebasedonthestandard,openalgorithmforSOUNDEXevaluation.

    Input:string(string)

    Output:result(string) Examples.Ifmylink.mystring1containsthestring"Griffin"thenthe

    followingfunctionreturnsthecode"G615".Soundex(mylink.mystring1)Ifmylink.mystring1containsthestring"Griphin"thenthefollowingfunctionalsoreturnsthecode"G615".Soundex(mylink.mystring1)

    SpaceReturnsastringofnspacecharacters.

    Input:length(int32)

    Output:result(string) Examples.Ifmylink.mylengthcontainsthenumber100,thenthe

    followingfunctionreturnsastringthatcontains100spacecharacters.Space(mylink.mylength)

    SQuoteEnclosesastringinsinglequotationmarks.

  • Input:string(string)

    Output:result(string) Examples.Ifmylink.mystring1containsthestringneedsquotes,thenthe

    followingfunctionreturnsthestring'needsquotes'.SQuote(mylink.mystring1)

    StrRepeatsastringthespecifiednumberoftime.

    Input:string(string)

    Output:result(string) Examples.Ifmylink.mystring1containsthestringneeds"choc",thenthe

    followingfunctionreturnsthestring"chocchocchocchocchoc".Str(mylink.mystring1,5)

    StripWhiteSpaceReturnsthestringafterremovingallwhitespacecharactersfromit.

    Input:string(string)repeats(int32)

    Output:result(string) Examples.Ifmylink.mystringcontainsthestring"toomanyspaces",

    thenthefollowingfunctionreturnsthestring"toomanyspaces":StripWhiteSpace(mylink.mystring)

    TrimRemoveallleadingandtrailingspacesandtabsplusreduceinternaloccurrencestoone.Theargumentstripcharoptionallyspecifiesacharacterotherthanaspaceoratab.Theargumentoptionsoptionallyspecifiesthetypeoftrimoperationtobeperformedandcontainsoneormoreofthefollowingvalues:ARemovealloccurrencesofstripchar

    BRemovebothleadingandtrailingoccurrencesofstripcharDRemoveleading,trailing,andredundantwhitespacecharactersERemovetrailingwhitespacecharactersFRemoveleadingwhitespacecharactersLRemoveallleadingoccurrencesofstripcharRRemoveleading,trailing,andredundantoccurrencesofstripcharTRemovealltrailingoccurrencesofstripchar

    Input:string(string)[stripchar(string)][options(string)] Output:result(string) Examples.Ifmylink.mystringcontainsthestring"Stringwithwhitespace

    ",thenthefollowingfunctionreturnsthestring"Stringwithwhitespace":Trim(mylink.mystring)

  • Ifmylink.mystringcontainsthestring"..Remove..redundant..dots....",thenthefollowingfunctionreturnsthestring"Remove.redundant.dots":Trim(mylink.mystring,".")Ifmylink.mystringcontainsthestring"Remove..all..dots....",thenthefollowingfunctionreturnsthestring"Removealldots":Trim(mylink.mystring,".","A")Ifmylink.mystringcontainsthestring"Remove..trailing..dots....",thenthefollowingfunctionreturnsthestring"Remove..trailing..dots":Trim(mylink.mystring,".","T")

    TrimBRemovesalltrailingspacesandtabsfromastring.

    Input:string(string)

    Output:result(string) Examples.Ifmylink.mystringcontainsthestring"toomanytrailing

    spaces",thenthefollowingfunctionreturnsthestring"toomanytrailingspaces":TrimB(mylink.mystring)

    TrimFRemovesallleadingspacesandtabsfromastring.

    Input:string(string)

    Output:result(string) Examples.Ifmylink.mystringcontainsthestring"toomanyleading

    spaces",thenthefollowingfunctionreturnsthestring"toomanyleadingspaces":TrimF(mylink.mystring)

    TrimLeadingTrailingRemovesallleadingandtrailingspacesandtabsfromastring.

    Input:string(string)

    Output:result(string) Examples.Ifmylink.mystringcontainsthestring"toomanyspaces",

    thenthefollowingfunctionreturnsthestring"toomanyspaces":TrimLeadingTrailing(mylink.mystring)

    UpCaseChangesalllowercaselettersinastringtouppercase.

    Input:string(string)

    Output:result(string) Examples.Ifmylink.mystring1containsthestring"CaMelcAsE",then

    thefollowingfunctionreturnsthestring"CAMELCASE".UpCase(mylink.mystring1)

  • VectorfunctionUsethevectorfunctiontoaccessanelementinavectorcolumn.ThefunctionisintheVectorcategoryoftheexpressioneditor.TheexamplesshowthefunctionasitappearsinaDerivationfieldintheTransformerstage.ElementAt

    Accessesanelementofavector.Thevectorindexstartsat0.Thefunctioncanbeusedaspartof,orthewholeofanexpression.

    Input:input_column(columnname)index(int)

    Output:elementofvector Examples.Thefollowingexampleoutputsthesecondelementofthe

    vectorinthecolumnmylink.myvector.ElementAt(mylink.myvector,2)Thefollowingexampleoutputsthesecondelementofthevectorinthecolumnmylink.myvectorandaddsoneit.ElementAt(mylink.myvector,2)+1

    TypeconversionfunctionsUsethetypeconversionfunctionstochangethetypeofanargument.ThefollowingfunctionsareintheTypeConversioncategoryoftheexpressioneditor.Squarebracketsindicateanargumentisoptional.Thedefaultdateformatis%yyyy%mm%dd.TheexamplesshowthefunctionasitappearsinaDerivationfieldintheTransformerstage.Char

    GeneratesanASCIIcharacterfromitsnumericcodevalue.Youcanoptionallyspecifytheallow8bitsargumenttoconvert8bitASCIIvalues.

    Input:code(number),[allow8bits]

    Output:result(char) Examples.ThefollowingexampleoutputstheASCIIcode65asthe

    characterA.Char(65)

    DateToStringReturnsthestringrepresentationofthegivendate.Theformatofthestringcanoptionallybespecified.

    Input:date(date),[format(string)]

    Output:result(string) Examples.Thefollowingexampleoutputsthedatecontainedinthe

  • columnmylink.mydatetoastring.Ifmylink.mydatecontainsthedate18thAugust,2009,thentheoutputstringis"20090818":DateToString(mylink.mydate)Thefollowingexampleoutputsthedatecontainedinthecolumnmylink.mydatetoastringwiththeformatdd:mm:yyyy.Ifmylink.mydatecontainedthedate18thAugust,2009,thentheoutputstringwouldbe"18:08:2009":DateToString(mylink.mydate,"%dd:%mm:%yyyy")

    DateToDecimalReturnsthegivendateasapackeddecimalvalue.Ifyourtargetdecimalspecifiesascale,partofthedateappearsafterthedecimalpoint.Youcanoptionallyspecifyaformatstringthatspecifieshowthedateisstoredinthedecimalnumber.Thedefaultformatstringis"%yyyy%mm%dd",so,forexample,thedate20090825isstoredasthedecimalnumber20090825.Formatstringscanonlyspecifyaformatthatcontainsnumbers.Forexample,youcannotspecifyaformatstringsuchas"%yyyy%mm%dd",becausethehyphencharacter()cannotbestoredinapackeddecimalvalue.Thefollowingtokensarevalidforconversionstoorfromdecimalvalues:%yyyy(fourdigityear)

    %yy(twodigityear)%NNNNyy(twodigityearwithcutoff)%mm(twodigitmonth)%dd(twodigitdayofmonth)%ddd(threedigitdayofyear)Theliteraldigits0to9arealsovalid.

    Input:basedate(date)[,format(string)] Output:converted_date(decimal) Examples.Ifthecolumnmylink.basedatecontainsthedate20120818,

    thenthefollowingfunctionstoresthedateasthedecimalnumber18082012:DateToDecimal(mylink.basedate,"%dd%mm%yyyy")Ifthecolumnmylink.basedatecontainsthedate20120818,andthetargetcolumnhasalengthof10andascaleof2,thenthefollowingfunctionstoresthedateasthedecimalnumber201208.18:DateToDecimal(mylink.basedate)

    DecimalToDateReturnsthegivenpackeddecimalasadate.Boththesignandthescaleofthedecimalnumberareignoredwhenitisconvertedtoadate.Youcanoptionallyspecifyaformatstringthatspecifieshowthedateisstoredinthedecimalnumber.Thedefaultformatstringis"%yyyy%mm%dd",so,forexample,thedate20090825isstoredasthedecimalnumber20090825.Formatstringscanonly

  • specifyaformatthatcontainsnumbers.Forexample,youcannotspecifyaformatstringsuchas"%yyyy%mm%dd",becausethehyphencharacter()cannotbestoredinapackeddecimalvalue.Thefollowingtokensarevalidforconversionstoorfromdecimalvalues:%yyyy(fourdigityear)

    %yy(twodigityear)%NNNNyy(twodigityearwithcutoff)%mm(twodigitmonth)%dd(twodigitdayofmonth)%ddd(threedigitdayofyear)Theliteraldigits0to9arealsovalid.

    Input:basedec(decimal)[,format(string)] Output:date Examples.Ifthecolumnmylink.mydecdatacontainsthevalue18082012,

    thenthefollowingfunctionreturnsthedate20120818:DecimalToDate(mylink.basedate,"%dd%mm%yyyy")Ifthecolumnmylink.mydecdatacontainsthevalue201208.18,thenthefollowingfunctionreturnsthedate20120818:DecimalToDate(mylink.basedate)

    DecimalToDecimalReturnsthegivendecimalindecimalrepresentationwithprecisionandscalespecifiedinthetargetcolumndefinition.Theargumentrtypeoptionallyspecifiesaroundingtype,andissettooneofthefollowingvalues:ceil.Roundthesourcefieldtowardpositiveinfinity.Forexample,1.4>2,1.6>1.floor.Roundthesourcefieldtowardnegativeinfinity.Forexample,1.6>1,1.4>2.round_inf.Roundortruncatethesourcefieldtowardthenearestrepresentablevalue,breakingtiesbyroundingpositivevaluestowardpositiveinfinityandnegativevaluestowardnegativeinfinity.Forexample,1.4>1,1.5>2,1.4>1,1.5>2.trunc_zero.Discardanyfractionaldigitstotherightoftherightmostfractionaldigitsupportedinthedestination,regardlessofsign.Forexample,ifthedestinationisaninteger,allfractionaldigitsaretruncated.Ifthedestinationisanotherdecimalwithasmallerscale,roundortruncatetothescalesizeofthedestinationdecimal.Forexample,1.6>1,1.6>1.

    Input:decimal(decimal)[,rtype(string)] Output:result(decimal) Examples.Ifthecolumnmylink.mydeccontainsthedecimalnumber

  • 2.5345,thefollowingfunctionreturnsthedecimalnumber00000002.54.DecimalToDecimal(mylink.mydec,"ceil")Thefollowingfunctionreturnsthedecimalnumber00000002.53.DecimalToDecimal(mylink.mydec,"floor")Thefollowingfunctionreturnsthedecimalnumber00000002.53.DecimalToDecimal(mylink.mydec,"trunc_zero")Thefollowingfunctionreturnsthedecimalnumber00000002.53.DecimalToDecimal(mylink.mydec,"round_inf")Inalltheseexamples,thetargetdecimalhasalengthof10andascaleof2.

    DecimalToDFloatReturnsthegivendecimalindfloatrepresentation.Theargument"fix_zero"optionallyspecifiesthatallzerodecimalvaluesareregardedasvalid(bydefault,decimalnumberscomprisingallzerosaretreatedasinvalid).

    Input:decimal(decimal)[,"fix_zero"]

    Output:result(dfloat) Examples.Ifthecolumnmylink.mydeccontainsthedecimalnumber

    00000004.00thefollowingfunctionreturnsthedfloatnumber4.00000000000000000E+00.DecimalToDFloat(mylink.mydec,"fix_zero")Ifthecolumnmylink.mydeccontainsthedecimalnumber00012344.00thefollowingfunctionreturnsthedfloatnumber1.23440000000000000E+04.DecimalToDFloat(mylink.mydec,"fix_zero")Ifthecolumnmylink.mydeccontainsthedecimalnumber00012344.120thefollowingfunctionreturnsthedfloatnumber1.23441200000000010E+04.DecimalToDFloat(mylink.mydec,"fix_zero")Ifthecolumnmylink.mydeccontainsthedecimalnumber00012344.120thefollowingfunctionreturnsthedfloatnumber1.23441200000000010E+04.DecimalToDFloat(mylink.mydec)Ifthecolumnmylink.mydeccontainsthedecimalnumber00012344.000thefollowingfunctionreturnsthedfloatnumber1.23440000000000000E+04.DecimalToDFloat(mylink.mydec)

    DecimalToStringReturnsthegivendecimalasastring.Theargument"fix_zero"optionallyspecifiesthatallzerodecimalvaluesareregardedasvalid(bydefault,decimalnumberscomprisingallzerosaretreatedasinvalid).Thiscoversthecasewherethesignbitsofthepackeddecimalrepresentationareall0aswellasallthecontentdigits.Thiscastisnotconsideredvalidunless"fix_zero"istrue.

    Input:decimal(decimal)[,"fix_zero"]

  • Output:result(string) Examples.Ifthecolumnmylink.mydeccontainsthedecimalnumber

    00000004.00,thefollowingfunctionreturnsthestring"4":DecimalToString(mylink.mydec,"suppress_zero")Ifthecolumnmylink.mydeccontainsthedecimalnumber00000004.00,thefollowingfunctionreturnsthestring"0000000000000000000000000004.0000000000".DecimalToString(mylink.mydec,"fix_zero")Ifthecolumnmylink.mydeccontainsthedecimalnumber00012344.00,thefollowingfunctionreturnsthestring"12344".DecimalToString(mylink.mydec,"suppress_zero")Ifthecolumnmylink.mydeccontainsthedecimalnumber00012344.00,thefollowingfunctionreturnsthestring"0000000000000000000000012344.0000000000".DecimalToString(mylink.mydec,"fix_zero")Ifthecolumnmylink.mydeccontainsthedecimalnumber00012344.120,thefollowingfunctionreturnsthestring"0000000000000000000000012344.1200000000".DecimalToString(mylink.mydec,"fix_zero")Ifthecolumnmylink.mydeccontainsthedecimalnumber00012344.120,thefollowingfunctionreturnsthestring"12344.12":DecimalToString(mylink.mydec,"suppress_zero")Ifthecolumnmylink.mydeccontainsthedecimalnumber00012344.120,thefollowingfunctionreturnsthestring"0000000000000000000000012344.120000000".DecimalToString(mylink.mydec)Ifthecolumnmylink.mydeccontainsthedecimalnumber00012344.000,thefollowingfunctionreturnsthestring"0000000000000000000000012344.0000000000".DecimalToString(mylink.mydec)

    DecimalToTimeReturnsthegivenpackeddecimalasatime.Youcanoptionallyspecifyaformatstringthatspecifieshowthetimeisstoredinthedecimalnumber.Thedefaultformatstringis"%hh%nn%ss",so,forexample,thetime14:03:22isstoredasthedecimalnumber140322.Formatstringscanonlyspecifyaformatthatcontainsnumbers.Forexample,youcannotspecifyaformatstringsuchas"%hh:%nn:%ss",becausethecoloncharacter(:)cannotbestoredinapackeddecimalvalue.Thefollowingtokensarevalidforconversionstoorfromdecimalvalues:%hh(twodigithoursusing24hourclock)

    %nn(twodigitminutes)%ss(twodigitseconds)%ss.N(twodigitseconds,plusthenumberoffractionaldigitsallowed.Thenumberoffractionaldigitsisfromonetosixinclusive).

  • Theliteraldigits0to9arealsovalid.Ifyourspecifiedformatincludesmicroseconds(forexample,%ss.4),thenthepositionofthedecimalpointisinferredinthedecimalvalue.Thepositionofthedecimalpointdoesnothavetocoincidewiththespecifiedscaleofthedecimal(forexample,scale=4).

    Input:time(time)[,format(string)] Output:result(decimal) Examples:Ifthecolumnmylink.mytimedeccontainsthedecimalvalue

    200658,thenthefollowingfunctionreturnsthetime20:06:58:DecimalToTime(mylink.mytimedec)Ifthecolumnmylink.mytimedeccontainsthedecimalvalue580620,thenthefollowingfunctionreturnsthetime20:06:58:DecimalToTime(mylink.mytimedec,"%ss%nn%hh")

    DecimalToTimestampReturnsthegivenpackeddecimalasatimestamp.Youcanoptionallyspecifyaformatstringthatspecifieshowthetimestampisstoredinthedecimalnumber.Thedefaultformatstringis"%yyyy%mm%dd%hh%nn%ss",so,forexample,thetimestamp2009082514:03:22isstoredasthedecimalnumber20090825140322.Formatstringscanonlyspecifyaformatthatcontainsnumbers.Forexample,youcannotspecifyaformatstringsuchas"%yyyy/%mm/%dd%hh:%nn:%ss",becausetheslashcharacter(/)andthecoloncharacter(:)cannotbestoredinapackeddecimalvalue.Thefollowingtokensarevalidforconversionstoorfromdecimalvalues:%yyyy(fourdigityear)

    %yy(twodigityear)%NNNNyy(twodigityearwithcutoff)%mm(twodigitmonth)%dd(twodigitdayofmonth)%ddd(threedigitdayofyear)%hh(twodigithoursusing24hourclock)%nn(twodigitminutes)%ss(twodigitseconds)%ss.N(twodigitseconds,plusthenumberoffractionaldigitsallowed.Thenumberoffractionaldigitsisfromonetosixinclusive).Theliteraldigits0to9arealsovalid.Ifyourspecifiedformatincludesmicroseconds(forexample,%ss.4),thenthepositionofthedecimalpointisinferredinthedecimalvalue.Thepositionofthedecimalpointdoesnothavetocoincidewiththespecifiedscaleofthedecimal(forexample,scale=4).

  • Input:timestamp(timestamp)[,format(string)] Output:result(decimal) Examples:Ifthecolumnmylink.mytimestampdeccontainsthevalue

    19580818200658,thenthefollowingfunctionreturnsthetimestamp1958081820:06:58:DecimalToTimestamp(mylink.mytimestampdec)Ifthecolumnmylink.mytimestampdeccontainsthedecimalvalue200658580818,thenthefollowingfunctionreturnsthetimestamp1958081820:06:58:DecimalToTimestamp(mylink.mytimestampdec,"%hh%nn%ss%yy%mm%dd")

    DFloatToDecimalReturnsthegivendfloatindecimalrepresentation.Theargumentrtypeoptionallyspecifiesaroundingtype,andissettooneofthefollowingvalues:ceil.Roundthesourcefieldtowardpositiveinfinity.Forexample,1.4>2,1.6>1.floor.Roundthesourcefieldtowardnegativeinfinity.Forexample,1.6>1,1.4>2.round_inf.Roundortruncatethesourcefieldtowardthenearestrepresentablevalue,breakingtiesbyroundingpositivevaluestowardpositiveinfinityandnegativevaluestowardnegativeinfinity.Forexample,1.4>1,1.5>2,1.4>1,1.5>2.trunc_zero.Discardanyfractionaldigitstotherightoftherightmostfractionaldigitsupportedinthedestination,regardlessofsign.Forexample,ifthedestinationisaninteger,allfractionaldigitsaretruncated.Ifthedestinationisanotherdecimalwithasmallerscale,roundortruncatetothescalesizeofthedestinationdecimal.Forexample,1.6>1,1.6>1.

    Input:number(dfloat),[rtype(string)] Output:result(decimal) Examples.Ifthecolumnmylink.myfloatcontainsthedfloatnumber

    2.534,thefollowingfunctionreturnsthedecimalnumber00000002.54.DFloatToDecimal(mylink.mydec,"ceil")Ifthecolumnmylink.myfloatcontainsthedfloatnumber2.534,thefollowingfunctionreturnsthedecimalnumber00000002.53.DFloatToDecimal(mylink.mydec,"floor")Ifthecolumnmylink.myfloatcontainsthedfloatnumber2.534,thefollowingfunctionreturnsthedecimalnumber00000002.53.DFloatToDecimal(mylink.mydec,"trunc_zero")Ifthecolumnmylink.myfloatcontainsthedfloatnumber2.534,thefollowingfunctionreturnsthedecimalnumber00000002.53.DFloatToDecimal(mylink.mydec,"round_inf")

    DfloatToStringNoExp

  • Returnsthegivendfloatinitsstringrepresentationwithnoexponent,usingthespecifiedscale.

    Input:number(dfloat),scale(string)

    Output:result(string) Examples.Ifthecolumnmylink.myfloatcontainsthedfloatnumber

    2.534,thenthefollowingfunctionreturnsthestring00000002.50:DfloatToStringNoExp(mylink.myfloat,2)

    IsValidReturnswhetherthegivenstringisvalidforthegiventype.Validtypesare"date","decimal","dfloat","sfloat","int8","uint8","int16","uint16","int32","uint32","int64","uint64","raw","string","time","timestamp","ustring".Fordatatypesofdate,time,andtimestamp,youcanoptionallyspecifyaformatstring.Theformatstringdescribestheformatthatyourinputdatauseswhenitdiffersfromthedefaultformatsfordate,time,ortimestamp.Thedefaultformatfordateis%yyyy%mm%dd.Thedefaultformatfortimeis"%hh:%mm:%ss".Thedefaultformatfortimestampis%yyyy%mm%dd%hh:%mm:%ss".

    Input:type(string),teststring(string)[,format(string)]

    Output:result(int8) Examples.Ifthecolumnmylink.mystringcontainsthestring"1",thenthe

    followingfunctionreturnsthevalue1.IsValid("int8",mylink.mystring)Ifthecolumnmylink.mystringcontainsthestring"380096.06",thenthefollowingfunctionreturnsthevalue0.IsValid("int8",mylink.mystring)

    IsValidDateReturnswhetherthegivenvalueisvalidforthetypedate.

    Input:testdate(date)

    Output:result(int8) Examples.Ifthecolumnmylink.mydatecontainsthedate20110913,

    thenthefollowingfunctionreturnsthevalue1.IsValidDate(mylink.mydate)Ifthecolumnmylink.mydatecontainsthestring"380096.06",thenthefollowingfunctionreturnsthevalue0,becausetheconvertedstringisnotavaliddate.IsValidDate(StringTodate(mylink.mydate))

    IsValidDecimalReturnswhetherthegivenvalueisvalidforthetypedecimal.Iftheallzerosflagissetto0,thenanallzeroesrepresentationisnotvalid.Theallzerosflagissettozerobydefault.

    Input:testvalue(decimal)[,allzerosflag(uint8)]

  • Output:result(int8) Examples.Ifthecolumnmylink.mynumcontainsthevalue310007.65,

    thenthefollowingfunctionreturnsthevalue1.IsValidDecimal(mylink.mynum)Ifthecolumnmylink.mynumcontainsthestring"wakerobin",thenthefollowingfunctionreturnsthevalue0,becausetheconvertedstringisnotavaliddecimal.IsValidDecimal(StringToDecimal(mylink.mynum))

    IsValidTimeReturnswhetherthegiventimeisvalidforthetypetime.

    Input:testtime(time)

    Output:result(int8) Examples.Ifthecolumnmylink.mytimecontainsthetime23:09:22,then

    thefollowingfunctionreturnsthevalue1:IsValidTime(mylink.mytime)Ifthecolumnmylink.mydatecontainsthestring"IbnKayeed",thenthefollowingfunctionreturnsthevalue0,becausetheconvertedstringisnotavalidtime.IsValidTime(StringToTime(mylink.mytime))

    IsValidTimestampReturnswhetherthegiventimestampisvalidforthetypetimestamp.

    Input:testtimestamp(timestamp)

    Output:result(int8) Examples.Ifthecolumnmylink.mytimestampcontainsthetime

    2011091323:09:22,thenthefollowingfunctionreturnsthevalue1:IsValidTimestamp(mylink.mytimestamp)Ifthecolumnmylink.mytimestampcontainsthestring"oneoftwo",thenthefollowingfunctionreturnsthevalue0,becausetheconvertedstringisnotavalidtimestamp.IsValidTimestamp(StringToTimestamp(mylink.mytimestamp))

    RawNumAtReturnstheintegervalueatthespecifiedindexvalueinthespecifiedrawfield.Theindexstartsat0.

    Input:rawfield(raw),index(int32)

    Output:result(int32) Examples.Ifthecolumnmylink.myrawcontainsarawvaluederived

    fromthestring"hello",thenthefollowingfunctionreturnstheinteger0x68(theASCIIcodeforthecharacterh):RawNumAt(mylink.myraw,0)Ifthecolumnmylink.myrawcontainsarawvaluederivedfromthestring"hello",thenthefollowingfunctionreturns0becausethespecifiedindex

  • isoutofrange:RawNumAt(mylink.myraw,12)

    RawToStringReturnsthegivenrawvalueasastringrepresentation.Youmustensurethattherawinputvaluecontainsasequenceofbytesthatarevalidascharactersinthetargetcharactersetinwhichtheoutputstringisused.Forexample,therawvalue{0xE00x410x42}isnotavalidsequenceofUTF8characters,sincetheleadbyte,0xE0,issupposedtobefollowedbyabyteintherange[0x80..0xBF].Ifarawvalue{xE0x41x42}ispassedtotheRawToStringfunction,therecouldbeanerroriftheoutputstringisthenaccessedasifitwereencodedinUTF8.

    Input:rawfield(raw)

    Output:result(string) Examples.Ifthecolumnmylink.myrawcontainsthevalue{0x310x31

    0x300x350x320x320x300x39},thenthefollowingfunctionreturnsthestring"11052209".RawNumAt(mylink.myraw)

    SeqGeneratesanumericcodevaluefromanASCIIcharacter.Youcanoptionallyspecifytheallow8bitsargumenttoconvert8bitASCIIvalues.

    Input:Seq(char)

    Output:result(number) Examples.ThefollowingexampleoutputsthecharacterAastheASCII

    code65.Seq("A")

    SeqAtReturnsthenumericcodepointvalueofthecharacteratthespecifiedpositioninthegivenstring.Theindexstartsat0.Ifthespecifiedindexisoutofrange,thefunctionreturns0.

    Input:basestring(string),index(int32)

    Output:result(int32) Examples.Ifthecolumnmylink.mystringcontainsthestring"horse",then

    thefollowingfunctionreturnsthevalue0x6F(thatis,theASCIIvalueofthecharactero).SeqAt(mylink.mystring,1)

    StringToDateReturnsadatefromthegivenstringinthegivenformat.Youdonothavetospecifyaformatstringifyourstringcontainsadateinthedefaultformatyyyymmdd.

    Input:string(string)[,format(string)]

    Output:result(date)

  • Examples:Ifthecolumnmylink.mystringcontainsthestring19580818,thenthefollowingfunctionreturnsthedate19580818.StringToDate(mylink.mystring)Ifthecolumnmylink.mystringcontainsthestring18:08:1958,thenthefollowingfunctionreturnsthedate19580818.StringToDate(mylink.mystring,"%dd:%mm:%yyyy")

    StringToDecimalReturnsthegivenstringasadecimalrepresentation.Theargumentrtypeoptionallyspecifiesaroundingtype,andissettooneofthefollowingvalues:ceil.Roundthesourcefieldtowardpositiveinfinity.Forexample,1.4>2,1.6>1.floor.Roundthesourcefieldtowardnegativeinfinity.Forexample,1.6>1,1.4>2.round_inf.Roundortruncatethesourcefieldtowardthenearestrepresentablevalue,breakingtiesbyroundingpositivevaluestowardpositiveinfinityandnegativevaluestowardnegativeinfinity.Forexample,1.4>1,1.5>2,1.4>1,1.5>2.trunc_zero.Discardanyfractionaldigitstotherightoftherightmostfractionaldigitsupportedinthedestination,regardlessofsign.Forexample,ifthedestinationisaninteger,allfractionaldigitsaretruncated.Ifthedestinationisanotherdecimalwithasmallerscale,roundortruncatetothescalesizeofthedestinationdecimal.Forexample,1.6>1,1.6>1.

    Input:string(string),[rtype(string)] Output:result(decimal) Examples.Ifthecolumnmylink.mystringcontainsthestring"19982.22",

    andthetargetisdefinedashavingaprecisionof7andascaleof2,thenthefollowingfunctionreturnsthedecimal19983.22.StringToDecimal(mylink.mystring)Ifthecolumnmylink.mystringcontainsthestring"19982.2276",andthetargetisdefinedashavingaprecisionof7andascaleof2,thenthefollowingfunctionreturnsthedecimal19983.23.StringToDecimal(mylink.mystring,"ceil")

    StringToRawReturnsastringinrawrepresentation.

    Input:string(string)

    Output:result(raw) Examples.Ifthecolumnmylink.mystringcontainsthestring"hello",and

    thetargetcolumnisdefinedasbeingoftypeBinarythenthefollowingfunctionreturnsthevalue{0x680x650x6C0x6C0x6F}.StringToRaw(mylink.mystring)

    StringToTime

  • Returnsatimerepresentationofthegivenstring. Input:string(string),[format(string)]

    Output:result(time) Examples:Ifthecolumnmylink.mystringcontainsthestring"20:06:58",

    thenthefunctionreturnsatimeof20:06:58.StringToTime(mylink.mystring)Ifthecolumnmylink.mystringcontainsthestring"20:6:58",thenthefunctionreturnsatimeof20:06:58.StringToTime(mylink.mystring,"%(h,s):$(n,s):$(s,s)")

    StringToTimestampReturnsatimerepresentationofthegivenstring.

    Input:string(string)[format(string)]

    Output:result(time) Examples:Ifthecolumnmylink.mystringcontainsthestring

    "1958080820:06:58",thenthefunctionreturnsthetimestamp1958080820:06:58.StringToTimestamp(mylink.mystring)Ifthecolumnmylink.mystringcontainsthestring"8/8/195820:6:58",thenthefunctionreturnsthetimestamp1958080820:06:58.StringToTimestamp(mylink.mystring,"%(d,s)/%(m,s)/%yyyy%(h,s):$(n,s):$(s,s)")

    StringToUstringReturnsaustringfromthegivenstring,optionallyusingthespecifiedmap(otherwiseusesprojectdefault).

    Input:string(string),[mapname(string)]

    Output:result(ustring) Examples:Ifthecolumnmylink.mystringcontainsthestring"11052009",

    thenthefollowingfunctionreturnstheustring"11052009"StringToUstring(mylink.mystring)

    TimestampToDateReturnsadatefromthegiventimestamp.

    Input:timestamp(timestamp)

    Output:result(date) Examples:Ifthecolumnmylink.mytimestampcontainsthetimestamp

    1958081820:06:58,thenthefollowingfunctionreturnsthedate19580818:TimestampToDate(mylink.mytimestamp)

    TimestampToDecimalReturnsthegiventimestampasapackeddecimal.Youcanoptionallyspecifyaformatstringthatspecifieshowthetimestampisstoredinthedecimalnumber.

  • Thedefaultformatstringis"%yyyy%mm%dd%hh%nn%ss",so,forexample,thetimestamp2009082514:03:22isstoredasthedecimalnumber20090825140322.Formatstringscanonlyspecifyaformatthatcontainsnumbers.Forexample,youcannotspecifyaformatstringsuchas"%yyyy/%mm/%dd%hh:%nn:%ss",becausetheslashcharacter(/)andthecoloncharacter(:)cannotbestoredinapackeddecimalvalue.Thefollowingtokensarevalidforconversionstoorfromdecimalvalues:%yyyy(fourdigityear)

    %yy(twodigityear)%NNNNyy(twodigityearwithcutoff)%mm(twodigitmonth)%dd(twodigitdayofmonth)%ddd(threedigitdayofyear)%hh(twodigithoursusing24hourclock)%nn(twodigitminutes)%ss(twodigitseconds)%ss.N(twodigitseconds,plusthenumberoffractionaldigitsallowed.Thenumberoffractionaldigitsisfromonetosixinclusive).Theliteraldigits0to9arealsovalid.Ifyourspecifiedformatincludesmicroseconds(forexample,%ss.4),thenthepositionofthedecimalpointisinferredinthedecimalvalue.Thepositionofthedecimalpointdoesnothavetocoincidewiththespecifiedscaleofthedecimal(forexamplescale=4).

    Input:timestamp(timestamp)[,format(string)] Output:result(decimal) Examples:Ifthecolumnmylink.mytimestampcontainsthetimestamp

    1958081820:06:58,thenthefollowingfunctionreturnsthedecimalvalue19580818200658:TimestampToDecimal(mylink.mytimestamp)Ifthecolumnmylink.mytimestampcontainsthetimestamp1958081820:06:58,thenthefollowingfunctionreturnsthedecimalvalue200658580818:TimestampToDecimal(mylink.mytimestamp,"%hh%nn%ss%yy%mm%dd")

    TimestampToStringReturnsastringfromthegiventimestamp.

    Input:timestamp(timestamp)[format(string)]

    Output:result(string) Examples:Ifthecolumnmylink.mytimestampcontainsthetimestamp

  • 1958081820:06:58,thenthefunctionreturnsthestring"1958081820:06:58".TimestampToString(mylink.mytimestamp)Ifthecolumnmylink.mytimestampcontainsthetimestamp1958081820:06:58,thenthefunctionreturnsthestring"18/08/195820:06:58":TimestampToString(mylink.mytimestamp,"%dd/%mm/%yyyy%hh:$nn:$ss")

    TimestampToTimeReturnsthestringrepresentationofthegiventimestamp.

    Input:timestamp(timestamp)

    Output:result(time) Examples:Ifthecolumnmylink.mytimestampcontainsthetimestamp

    1958081820:06:58,thenthefunctionreturnsthetime20:06:58:TimestampToTime(mylink.mytimestamp)

    TimeToStringReturnsastringfromthegiventime.

    Input:timestamp(timestamp)[format(string)]

    Output:result(time) Examples:Ifthecolumnmylink.mytimecontainsthetime20:06:58,then

    thefollowingfunctionreturnsthestring"20:06:58":TimeToString(mylink.mytime)Ifthecolumnmylink.mytimecontainsthetime20:06:58,thenthefollowingfunctionreturnsthestring"58:06:20":TimeToString(mylink.mytime,"%ss:$nn:$hh")

    TimeToDecimalReturnsthegiventimeasapackeddecimal.Youcanoptionallyspecifyaformatstringthatspecifieshowthetimeisstoredinthedecimalnumber.Thedefaultformatstringis"%hh%nn%ss",so,forexample,thetime14:03:22isstoredasthedecimalnumber140322.Formatstringscanonlyspecifyaformatthatcontainsnumbers.Forexample,youcannotspecifyaformatstringsuchas"%hh:%nn:%ss",becausethecoloncharacter(:)cannotbestoredinapackeddecimalvalue.Thefollowingtokensarevalidforconversionstoorfromdecimalvalues:%hh(twodigithoursusing24hourclock)

    %nn(twodigitminutes)%ss(twodigitseconds)%ss.N(twodigitseconds,plusthenumberoffractionaldigitsallowed.Thenumberoffractionaldigitsisfromonetosixinclusive).Theliteraldigits0to9arealsovalid.

  • Ifyourspecifiedformatincludesmicroseconds(forexample,%ss.4),thenthepositionofthedecimalpointisinferredinthedecimalvalue.Thepositionofthedecimalpointdoesnothavetocoincidewiththespecifiedscaleofthedecimal(forexamplescale=4).

    Input:time(time)[,format(string)] Output:result(decimal) Examples:Ifthecolumnmylink.mytimecontainsthetime20:06:58,then

    thefollowingfunctionreturnsthedecimalvalue200658:TimeToDecimal(mylink.mytime)Ifthecolumnmylink.mytimecontainsthetime20:06:58,thenthefollowingfunctionreturnsthedecimalvalue580620:TimeToDecimal(mylink.mytime,"%ss%nn%hh")

    UstringToStringReturnsastringfromthegivenustring,optionallyusingthespecifiedmap(otherwiseusesprojectdefault).

    Input:string(ustring)[,mapname(string)]

    Output:result(string) Examples:Ifthecolumnmylink.myustringcontainstheustring

    "11052009",thenthefollowingfunctionreturnsthestring"11052009":UstringToString(mylink.myustring)

    UtilityfunctionsTheutilityfunctionshaveavarietyofpurposes.ThefollowingfunctionsareavailableintheUtilitycategory(squarebracketsindicateanargumentisoptional):GetEnvironment

    Returnsthevalueofthegivenenvironmentvariable. Input:environmentvariable(string)

    Output:result(string) Examples.Ifyouqueriedthevalueoftheenvironmentvariablename

    APT_RDBMS_COMMIT_ROWSthenthefollowingderivationmightreturnthevalue"2048".GetEnvironment("APT_RDBMS_COMMIT_ROWS")

    GetSavedInputRecordThisfunctionisusedtoimplementtheaggregatingofdataontheinputlinkofaTransformerstage.YoucalltheGetsSavedInputRecordfunctiontoaretrieveacopyofaninputrowthatyouhavepreviouslysavedtoacachearea.Thefunctionretrievesthenextinputrowfromthecache(intheorderinwhichtheyweresavedtothecache)andmakesitthecurrentinputrow.Theretrievedrowoverrideswhatwasthecurrentinputrow,andsoanyderivationusinganinputcolumnvaluewill

  • usethevalueofthatcolumnintheinputrowretrievedfromthecache,notwhatwaspreviouslythecurrentinputrow.YoumustcallGetSavedInputRecordinaloopvariablederivation,youcannotcallitfromanywhereelse.Forexample,youcannotcallGetSavedInputRecordintheLoopConditionexpression.YoucancallGetSavedInputRecord,multipletimesandretrievethenextcachedrowoneachcall.UsetheSaveInputRecordfunctiontostorerowstothecache.GetSavedInputRecordreturnsthecacheindexnumberoftherecordretrievedfromthatcache.

    Input:

    Output:cache_index_number Examples.Thefollowingexampleisthederivationofaloopvariable

    namedSavedRecordIndexinaTransformerstage:SavedRecordIndex:GetSavedInputRecord()

    NextSKChainThisfunctionisusedintheSlowlyChangingDimensionstageasthederivationforacolumnwiththeSKChainpurposecode.ThefunctionisnotusedintheTransformerstage.NextSKChainreturnsthevalueofthesurrogatekeycolumnforthenextrowinthechain,orthevaluethathasbeenspecifiedtouseforthelastrecordinthechain.

    Input:last_chain_value(int64)

    Output:surrogate_key_value(int64) Examples.Ifyouspecifythefollowingfunctioninthederivationfieldfor

    aSKChaincolumninanSCDstage,theoutputcolumncontainsthevalueofthesurrogatekeyofthenextrecordinthechain,orthevalue180858ifthisisthelastrowinthechain.NextSKChain(180858)

    NextSurrogateKeyReturnsthevalueofthenextsurrogatekey.Youmusthavepreviouslysetupyoursurrogatekeysource,anddefineddetailsontheSurrogateKeytaboftheStagepageoftheTransformerpropertieswindow.

    Input:

    Output:surrogate_key_value(int64) Example.Thederivationfieldofyoursurrogatekeycolumncontainsthe

    followingfunction:NextSurrogateKey()

    PrevSKChainThisfunctionisusedintheSlowlyChangingDimensionstageasthederivationforacolumnwiththeSKChainpurposecode.ThefunctionisnotusedintheTransformerstage.PrevSKChainReturnsthevalueofthesurrogatekeycolumnforthepreviousrecordinthechain,orthevaluethathasbeenspecifiedtouseforthefirstrecordinthechain.

  • Input:first_chain_value(int64)

    Output:surrogate_key_value(int64) Examples.Ifyouspecifythefollowingfunctioninthederivationfieldfor

    aSKChaincolumninanSCDstage,theoutputcolumncontainsthevalueofthesurrogatekeyofthepreviousrecordinthechain,orthevalue121060ifthisisthelastrowinthechain.PrevSKChain(121060)

    SaveInputRecordThisfunctionisusedtoimplementtheaggregatingofdataontheinputlinkofaTransformerstage.YoucalltheSaveInputRecordfunctiontosaveacopyofthecurrentinputrowtoacachearea.Thefunctionreturnsthecountofrecordsinthecache,startingfrom1.YoucancallSaveInputRecordfromwithinthederivationofastagevariableintheTransformerstage.YoucancallSaveInputRecordmultipletimesforthesameinputrow.Thefirstcalladdstheinputrowtothecacheandeachsubsequentcalladdsaduplicateofthatsameinputrowintothecache.So,forexample,ifSaveInputRecordiscalledthreetimesforoneinputrecord,thenthecachewillcontainthreerows,eachidenticaltotheoriginalinputrow.UsetheGetSavedInputRecordfunctiontoretrievetherowsthatyouhavestored.

    Input:

    Output:cache_record_count(int64) Examples.Thefollowingexampleisthederivationofastagevariable

    namedNumSavedRecordsinaTransformerstage:NumSavedRecords:SaveInputRecord()