Page 1 of 1

Rounding Decimal in Transformer

Posted: Mon Jul 30, 2007 6:07 am
by hsbc_ds_dev
Hi,

My source field is Decimal(26,3) and the target field is Decimal(7,0). I just want to have first 7 digits from the incoming value into my target column.

For example,
If incoming value is 1234567890123.999, then the target should have 1234567. I want to manipulate this within a Transformer (parallel) stage only.

Any guidance?

Thanks.

Posted: Mon Jul 30, 2007 6:30 am
by prasad.bodduluri
there is function in server jobs , i.e is fix

Posted: Mon Jul 30, 2007 6:38 am
by sanjay.v
First try using DecimalToDecimal function in transformer... and check for required output...
If this doesn't work, try this first convert the decimal field into string and use the string function Left() to get the first seven digits.Once you get this, convert this result back to Decimal for target mapping...

thanks,
sanjay

Posted: Wed Aug 01, 2007 2:31 am
by hsbc_ds_dev
Prasad, I already mentioned it's a Parallel job and I'm using a parallel transformer. And your reply anyway is not getting into my brain.

Sanjay, I tried doing it your way. DS is not giving proper output for records that have bigger numbers than the INT32 max value.

Could anyone help me out?

Thanks!

Posted: Wed Aug 01, 2007 3:15 am
by Zhang Bo
you should try sanjay.v's second solution, that works.FYI,
StringToDecimal(Left(DecimalToString(DSLink3.a,"suppress_zero"),7))

Posted: Wed Aug 01, 2007 3:49 am
by hsbc_ds_dev
Thanks Zhang Bo,
What a coincidence!!! I could just achieve it with some logic and then saw your reply - the logic given by you is exactly same what I've used :D