Transformer stage in datastage: analysis of various functions

Source: Internet
Author: User
Tags timestamp to date ustring

Transformer stage: Meaning of each function:

Date $ time

Function Name
Test Columns
Description
Test Results
 
Currentdate
Currentdate ()
Obtain the day DATE OF THE SYSTEM
2008-08-05
 
Currenttime
Currenttime ()
Obtain the current day of the system.
17:52:31
 
Currenttimestamp
Currenttimestamp ()
Obtain the date and time of the system on the current day.
2008-08-05 17:52:31
 
Hoursfromtime
Hoursfromtime ('08: 01: 02 ')
Hours
8
 
Juliandayfromdate
Juliandayfromdate ('2017-08-05 ')

2454685
 
Microsecondsfromtime
Microsecondsfromtime ('17: 52: 31 ')
Returns a subtle number.
0
 
Minutesfromtime
Minutesfromtime ('14: 24: 45 ')
Returns the number of minutes.
24
 
Monthdayfromdate
Monthdayfromdate ("2008-08-13 ")
Returns the day of the month.
13
 
Datefromdayssince
Datefromdayssince ('13', "2008-08-12 ")
Returns the date type after the date is added.
2008-08-25
 
Monthfromdate
Monthfromdate ('2017-09-01 ')
Returns the month of the current month.
9
 
Nextweekdayfromdate
Nextweekdayfromdate ('2017-08-10 ', 'thursday ')
Returns the next date of the specified day of the week.
2008-08-14
 
Previusweekdayfromdate
Previusweekdayfromdate ('2017-08-10 ', 'wednesday ')
The date of the current month is passed in.
2008-08-06
 
Secondsfromtime
Secondsfromtime ('17: 23: 44 ')
The number of seconds after the input time is returned.
44
 
Secondssincefromtimestamp
Secondssincefromtimestamp ('2017-08-06 10:01:31 ', '2017-08-19 09:12:31 ')
Returns the number of seconds after comparing two dates.
-1.12026e + 06 =

-1120260
 
TimeDate
TimeDate ()
Obtain the system time in the format of time, day, month, and year.
14:07:50 06 Aug 2008
 
Timefrommidnightseconds
Timefrommidnightseconds ('20140901 ')
The number of seconds passed in to obtain the time in seconds.
00:02:00
 
Timestampfromdatetime
Timestampfromdatetime ('2017-09-01 ', '07: 30: 41 ')
Input date. timestamp is returned for time integration.
2008-09-01 07:30:41
 
Timestampfromsecondssince
Timestampfromsecondssince ('20140901', '2017-08-07 11:12:13 ')
The number of seconds passed in. After timestamp is returned, the number of seconds is accumulated to the timestamp type.
2008-08-07 11:14:13
 
Timestampfromtimet
Timestampfromtimet ('20140901 ')
Returns the timestamp type on UNIX.
00:02:00
 
Timetfromtimestamp
Timetfromtimestamp ('2017-01-01 00:02:00 ')
The input timestamp Type Returns UNIX time_t
120
 
Weekdayfromdate
Weekdayfromdate ('2017-08-09 ', 'wednesday ')
Input date and day of the week return the number of days of the input date in the current week (excluding Sunday as the current week), and query up
3
 
Yeardayfromdate
Yeardayfromdate ('2017-09-09 ')
Returns the number of days of the input date.
253
 
Yearfromdate
Yearfromdate ('2017-09-09 ')
Input date returns the number of copies per year
2008
 
Yearweekfromdate
Yearweekfromdate ('2017-09-09 ')
Returns the week number of the input date.
37
 
Isvalid
If isvalid ('int32 ', customer) Then asinteger (dslink2.txn _ CNT) else''

 

If isvalid ('dfloat', dslink2.txn _ AMT) Then dslink2.txn _ AMT else''
Input a parameter and its matching type. If the parameter matches, the output is null.

"Date", "decimal ",

"Dfloat", "sfloat", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64 ", "Raw", "string", "time", "timestamp ". "ustring"
123

 

 

0000123.
 

 

Logicl

Function Name
Test Columns
Description
Test Results
 
Bitand
Bitand (235,25)

11101011 --- 235

December 25, 00011001

00001001 -- 9

 
Input two int-type parameters, convert them to binary, return the final parameter through the "or" relationship, when the ratio of 1 to 0 is 0, 1 to 1 is 1
9
 
Bitcompress
If bitcompress (0) = 0 then 0 else 1
The input parameter can only be 1 or 0. If the condition is true, 1 is returned.
0
 
Bitor
Bitor (321,123)

101000001 --- 321

001111011 --- 123

101111011 --- 379
Input two int-type parameters, convert them to binary, and return the final parameter through the "and" relationship. When the ratio of 1 to 0 is 1, 1 and 1 is 1
379
 
Bitxor
Bitxor (1, 321,123)

101000001 --- 321

001111011 --- 123

100111010 --- 314
Input two int parameters and convert them to binary. When the ratio of 1 to 0 is to 1
314
 
Not
Not (1 = 1)
Judge expression. If it is true, 0 is returned. If it is false, 1 is returned.
0
 

 

Number

Function Name
Test Columns
Description
Test Results
 
Asdouble
Asdouble (12.123456)
4 is rounded to the last decimal place.
12.1235
 
Asfloat
Asfloat (13.654321)
4 is rounded to the last decimal place.
13.6543
 
Asinteger
Asinteger (11.23)
Returns an integer after a decimal number is input.
11
 
Mantissafromdecimal
Mantissafromdecimal (15.123456)
Decimal number
1.23456e + 09

1234560000
 
Mantissafromdfloat
Mantissafromdfloat (16.22222)
Decimal number
2222
 

 

String

Function Name
Test Columns
Description
Test Results
 
Alnum
Alnum ('sting12 ')
Input parameter if the string type returns 1
1
 
Alpha
Alpha ('string ')
The input parameter must be string and cannot contain other characters. If yes, It is 0.
1
 
Compactwhitespace
Compactwhitespace ('string'): '': compactwhitespace ('a BC D'):'': compactwhitespace ('a B c D ')
Concatenates multiple string types into one
STR ing a BC d a B c d
 
Compare
Compare ('abc', 'def ', 'L'): '': Compare ('def', 'abc', 'R '):'': compare ('qwer ', 'qwer', 'R ')
Compare the string size by ASCII
-1

1

0
 
Comparenocase
Comparenocase ('B', 'C'): '': comparenocase ('A', 'A ')
Compare whether two strings are equal, equal to 0, not equal to-1
-1

0
 
Comparenum
Comparenum ('A', 'B', 1): '': comparenum ('B', 'B', 1):'': comparenum ('abc ', 'cde', 3): '': comparenum ('abcd', 'A', 4)
Compare the input parameters. If they are absolutely the same as 0, the input arg2 is included in the input arg1 as 1, and the input arg1 is not equal to-1.
-1

0

-1

1
 
Convert
Convert ('bd ', '12', 'abcdefghijk ')
The arg1 search parameter. arg2 is the parameter to be modified. Finally, the modified result is returned.
A1c2efghijk
 
Count
Count ('jxj', 'J ')
Obtains the total number of identical characters.
2
 
Dcount
Dcount ('jxj', 'J ')
Get the total of the same characters and Add 1 more
3
 
Downcase
Downcase ('acrm123acrm123acrm ')
Converts uppercase letters to lowercase letters.
Acrm123acrm123acrm
 
Dquote
Dquote ('abcd': 'mnb'): '123'
Concatenates two strings with double quotes
"Abcdmnb" 123
 
Field
Field ('parallel', 'l', 3)
Returns the string from the string.
E
 
Index
Index ('a; lkdfjioquejrlkjasopdifu', 'J', 2)
Index string 'J' until 2nd 'J' is found and returns the length.
13
 
Left
Left ('abcdefghjk ', 4)
4-character string from the left
ABCD
 
Right
Right ('abcdefghjk ', 4)
4-character string from the right
Hijk
 
Len
Len ('asdlkfjalsdf ')
Returns the length of a string.
12
 
Num
Num (1234)
If it is a number, 1 is returned. If it is not a number, 0 is returned.
1
 
Padstring
Padstring ('abc', 'acr ', 3)
The first parameter is the output parameter, the second parameter is the append parameter (only the first of the string), and the second parameter is the number of appends.
Abcdaaa
 
Soundex
Soundex ('longtop ')
Obtained by English pronunciation comparison
L523
 
 



 
Squote
Squote ('asdfasdf ': '12 ')
Enclose the input string in single quotes
'Asdfasdf12'
 
Str
STR ("A", 20-len ('asd '))
Associate the first parameter with the subsequent number, and copy the first parameter.
AAAAAAAAAAAAAAAAA
 
Space
Space (10-len ('asdf '))
Append Space
''
 
Stripwhitespace
Stripwhitespace ('AB e Q w e R ')
Remove all spaces in the string
Abeqwer
 
Trim
Trim ('askd ')

Trim ('kk a B C ','')

Trim ('kk a B C', '', 'A ')

Trim ('kk a B C', '', 'L ')

Trim ('kk a B C', '', 'B ')

Trim ('kk a B C', '', 'R ')

Trim ('kk a B C', '', 'F ')

Trim ('kk a B C', '', 'E ')

Trim ('kk a B C', '', 'D ')
Remove spaces on both sides

Remove unnecessary Spaces

Remove all spaces

Remove left and right Spaces

Remove both sides

Remove left and right sides and extra spaces

Remove spaces on the left

Remove spaces on the right

Remove unnecessary Spaces
Askd

Kk A B C

Kkabc

Kk A B C

Kk A B C

Kk A B C

Kk A B C

Kk A B C

Kk A B C
 
Trimb
Trimb ('kkkk ')
Remove spaces on the right
KKKK
 
Trimf
Trimf ('kkkk ')
Remove spaces on the left
KKKK
 
Trimleadingtrailing
Trimleadingtrailing ('K k ')
Remove leading and trailing Spaces
K
 
Upcase
Upcase ('abcd ')
Converts all lowercase letters to uppercase letters.
ABCD
 

 

 

 

Function Name
Test Columns
Description
Test Results
 
Char
Char (123)
Convert a number into an ascii code.
{
 
Datetostring
Datetostring ('2017-08-01 ', "% yyyy-% mm-% dd ")
Convert a date to a character
2008-08-01
 
Decimaltodecimal
Decimaltodecimal (13.55)
Convert decimecl type to decimal type
0000000000000000000000000013.5500000000
 
Decimaltodfloat
Decimaltodfloat (13.5678897866854464)
Convert decimecl type to float type and rounding
13.5679
 
Decimaltostring
Decimaltostring (123.567)
Convert decimecl type to string type output
0000000000000000000000000123.5670000000
 
Dfloattodecimal
Dfloattodecimal (12.5658)
Convert float to decimal type
0000000000000000000000000012.5658000000
 
Dfloattostringnoexp
Dfloattostringnoexp (29.10, '2'): '': dfloattostringnoexp (29.120, '3'):'': dfloattostringnoexp (29.120, '4 ')
Retrieves the dfloat digits and converts them to string output.
29

29.12

29.12
 
Seq
SEQ ('A'): '': seq ('B ')
Converts an input character to an ASCII number.
65 66
 
Stringtodate
Stringtodate ('123', "% yyyy % mm % dd ")
Convert a date of the character type to a date type output
1982-11-14
 
Stringtodecimal
Stringtodecimal ('12. 100', 'ceil '): '': stringtodecimal ('12. 100', 'floor ')
Obtain the maximum value.

Obtain the minimum value.
0000000000000000000000000012.3450000000

000
 
Stringtotime
Stringtotime ('000000', "% HH % NN % SS ")
Converts a time of character type to a time type.
08:11:14
 
Stringtotimestamp
Stringtotimestamp ('000000', "% yyyy % mm % DD % HH % NN % SS ")
Converts the timestamp type of a character to the timestamp type.
1926-12-12 00:12:45
 
Timestamptodate
Timestamptodate (currenttimestamp ())
Convert timestamp to date type
2008-08-12
 
Timestamptostring
Timestamptostring (currenttimestamp (), "% yyyy/% mm/% DD % hh/% NN/% SS ")
Convert the date type to the character type according to the returned format
2008/08/12 15/18/18
 
Timestamptotime
Timestamptotime (currenttimestamp ())
Convert timestamp to time type
15:18:18
 
Timetostring
Timetostring (currenttime (), "% hh-% Nn-% SS ")
Convert the time type to the character type according to the returned format
15-18-18
 
Stringtoustring
Stringtoustring ('ustring ')
Convert string type to ustring type (char, varchar, longvarchar)
Ustring
 
Ustringtostring
Ustringtostring ('string ')
Convert ustring (char, varchar, longvarchar) type to string type
String
 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.