Page 1 of 1

Substr of Decimal

Posted: Mon Mar 13, 2006 3:14 pm
by alisoviejo
Hi,
If I have the source as 11.34 I need only the numbers before the decimal, i.e. 11 .

Is there a stage I can use in EE instead of conventionally using the transformer?

Thanks,

Posted: Mon Mar 13, 2006 3:33 pm
by ray.wurlod
Modify stage. Use int32_from_decimal() or int64_from_decimal() function.

Posted: Mon Mar 13, 2006 5:14 pm
by alisoviejo
Would that round it off or just give the number before the decimal, becasue if it is 11.98 , still we need only 11.

I do not have the access to DS now, will try your idea Ray.

Thanks a bunch.

Posted: Mon Mar 13, 2006 5:18 pm
by ray.wurlod
There are optional pieces. You can specify truncation or rounding. It's all in the manual.

Posted: Mon Mar 13, 2006 10:38 pm
by Nageshsunkoji
Hi,

Use the following rounding function in the transformer. It will give your expected result.

DecimalToDecimal(ColumnName,'round_inf')

Regards
Nagesh.

Posted: Tue Mar 14, 2006 10:51 am
by alisoviejo
Hi Ray,

I have used

ME_TGT:int64=int64_from_decimal [trunc_zero] (ME_LOW)

ME_TGT:integer=int32_from_decimal [trunc_zero] (ME_LOW)

ME_TGT=int64_from_decimal [trunc_zero] (ME_LOW)

My source column is Real (40.8) and my target column is integer(ME_TGT).
The job aborts saying operator conversion not possible, am I missing onthe syntax. Appreciate your time.

Posted: Tue Mar 14, 2006 10:56 am
by alisoviejo
I got it, I changed the source column type to Decimal and the function works, thanks Ray!

Posted: Tue Mar 14, 2006 11:33 am
by ray.wurlod
Real and dfloat are approximate representations of data. Decimal and numeric are exact representations. They are different data types, which is why you experienced what you did. My original response was based on your statement that the data type was Decimal.