Wednesday, 6 February 2013

Type Conversion Functions


Hi friends Hear i am listing some Type conversion functions which are mostly used in our transformation logic's have a look on ............. 

DateToString:

Returns string representation of given date.
Here we can give or specify whatever date we want.

Ex:       dd-mm-yyyy,mm-dd-yyyy,yyyy-dd-mm
Syntax:  DateToString(%date%,[%yyyy%mm%dd%])

Ex :
1)DateToString( currentdate,”%yyyy\%mm\%dd”)
o/p:2008\10\08

2)DateToString( currentdate,”%yyyy-%mm-%dd”)
o/p:2008-10-08

3)DateToString( currentdate,”%yyyya%mma%dd”)
o/p:2008a10a08

4)DateToString( ‘2010-10-08’,”%yyyy-%mm-%dd”)
o/p:2010-10-08

5)DateToString(‘2010-10-08’,”%mm-%dd-%yyyy”)
o/p:10-08-2010

6)DateToString(‘10-08-2010’,”%dd-%mm-%yyyy”)

7)DateToString( currentdate,”%dd-%mm-%yyyy”)
o/p: 08-oct-2010

8)DateToString( currentdate,”%mm-%dd-%yyyy”)
o/p: oct-08-2010


DecimalToDecimal:

Syntax:   DecimalToDecimal(%Decimal%,%rounding%)

Ex:
1) DecimalToDecimal(12.345)
o/p: 12.35

2) DecimalToDecimal(12.342)
o/p: 12.34

3) DecimalToDecimal(1.3) ------>(2,1)   [length(9),scale(2)]
o/p: 0000001.30

4) DecimalToDecimal(289.347)-------> (6,3)
o/p: 0000289.35

5) DecimalToDecimal(299999999.007) -------->(12,3)
o/p: 0000000.00

6) DecimalToDecimal(2999999.3) ----->(8,1)
o/p: 2999999.30

7) DecimalToDecimal(1.7) ------>(2,1)   [length(9),scale(1)]
o/p: 00000001.7

8) DecimalToDecimal(1.7) ------>(2,1)   [length(9),scale(2)]
o/p: 0000001.70

9) DecimalToDecimal(1.78) ------>(3,2)   [length(9),scale(1)]
o/p: 0000001.8

10) DecimalToDecimal(000000110.00000) ------>Datatype(integer)
o/p: 110

StringToDate:

Returns a date from the given string in the given format.

Syntax:
StringToDate(%DateString%,[%”yyyy-%mm-%dd”%])

Ex:
1)StringToDate(“10201008”,”%mm%yyyy%dd”)
o/p:  2010-08-10

2)StringToDate(“10-2010-08”,”%mm-%yyyy-%dd”)
o/p:  2010-08-10

3)StringToDate(“10/08/2010”,”%mm/%yyyy/%dd”)
o/p:  not support(format is different)

IsValid:

Syntax:   IsValid(%typestring%,%valuestring%)



Ex:

1)IsValid(“Date”,”currentdate”)
o/p: 1

2)IsValid(“Date”,”0000:00:00”)
o/p: 0

3)IsValid(“Date”,”1999-13-11”)
o/p: 0

4)IsValid(“Date”,”1999-12-32”)
o/p: 0

5)IsValid(“Date”,”1999-12-12”)
o/p: 1

6)IsValid(“Decimal”,”12.3.345”)
o/p: 0

7)IsValid(“String”,”3.345”)
o/p: 1

8)IsValid(“Decimal(6,3)”,”123.345”)
o/p: 0

9)IsValid(“Decimal(7,3)”,”123.345”)
o/p: 0

10)IsValid(“String”,”GHJ123”)
o/p: 1

11)IsValid(“String”,”GHJ”)
o/p: 1

StringToDecimal:

Returns the given string in decimal representation

Syntax:
StringToDecimal(%String%,%rtype%)

Ex:
1)StringToDecimal(“34.56”)---->(4,2)  length(8), scale(2)
o/p: 000034.56



                                                                          ---Sudheerkumar

6 comments:

  1. this blog contains very nice information..it's very helpful to learners...we are giving datastage online training

    ReplyDelete
  2. Thanks....!!
    Post is understandable and useful for the people who refers for sap hana. Online services in IT Hub online Training
    on Datastage Online Training

    ReplyDelete
  3. Thanks for the Best topic. Very useful information.
    We IT hub Online Training are good in giving the datastage Training

    ReplyDelete
  4. Thank you for sharing it is useful information,
    It is very useful to who are searching for Datastage online training.

    ReplyDelete
  5. CASINO IN HILL, HILL, HILL, HILL, HILL, HILL, HILL, HILL, HILL
    The 의왕 출장샵 following four are in our group (not in the group) and (not 파주 출장샵 in the group) are 포항 출장안마 in our group. 1.) 2) All in our 통영 출장샵 group, like 제천 출장샵 a normal

    ReplyDelete