cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion of datatypes

Former Member
0 Kudos

Hi,

How to convert a field of type 'date' into 'decimal' on target side in while doing mapping.Anybody Pleaseee.....

Thanks & Regards,

Radhika.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi

No standard functions available for the tasks you mentioned.You need a UDF for the same.

Thanks

Former Member
0 Kudos

In the mapping, everything is pretty much passed as a String. So, if you can give me an example of the input and output of what you are trying to do in the mapping, I can probably design a UDF to handle your situation using the String class in java or basic XI provided functions.

Former Member
0 Kudos

Hi,

You need to write a UDF. Don't have standard functions.

<b>Cheers,

*RAJ*</b>

Former Member
0 Kudos

Radhika,

Can you please give more details..like your input data format and expected decimal output format..

If you have date in the format of DD-MM-YYYY...or any separator in between then using substring / concate first u need to get only number format and then you can convert into integer / double number...

Let us know what exactly you want to achieve...

Nilesh

Former Member
0 Kudos

Hi Nilesh,

My source field format is YYYYMMDD and target field is of DECIMAL(8,0) type.

Can u please tell me now....

Thanks & Regards,

Radhika.

justin_santhanam
Active Contributor
0 Kudos

Radhika,

Use FormatNum option. Anyhow your input will never change,coz of the date input -since it has exactly 8 digits. Double click on the Format num in the properties give how the source and target must look like.

Please correct if i'm wrong.

Input -- 20070818

Output ---20070818.0

Am I right?

Best regards,

raj.

Former Member
0 Kudos

Hi Radhika,

As Raj suggested you can use Format Number function...but can you please tell us by converting date into Dec what actually you are trying to achieve. I mean if you tell us exact requirement we can provide you better solution.

If you want to convert date into number for comparison then we can declare a variable as a integer than decimal...becase there wont be any decimal places..

Please let us know the exact requirement.

Nilesh