Page 1 of 1

Issue with Decimal Field conversion during output

Posted: Fri Oct 19, 2007 6:09 am
by meemaza
Hi everyone,

I have some strange requirements.
I have several amount fields with the data type Decimal(26,3),
While extracting into the file I have to produce data like:
1. empty value if the data value is 0.00
2. non-padded zero data with, currently it produce values padded with zero
e.g. Data is = 1234.560
output- now it is coming like 00000000000000000001234.560
but I dont want the initial zeros while extracting the values.

I wrote a custom c routine for this but it is very slow...
Pleae give me any suggestion now.

Thanks
Arvind

Posted: Fri Oct 19, 2007 6:38 am
by sudhakar_viswa
Hi,

Use numeric function to round the value.
Else convert into char and send it

Regards,
-- sudhakar

Posted: Fri Oct 19, 2007 9:02 am
by ray.wurlod
The leading zeroes are an artifact of the data viewer. They are not really there when a decimal data type is stored. Ignore them - they are included to prove that the precision and scale are being addressed correctly.

Posted: Fri Oct 19, 2007 9:54 am
by meemaza
sudhakar_viswa wrote:Hi,

Use numeric function to round the value.
Else convert into char and send it

Regards,
-- sudhakar
Thanks Sudhakar,
Basically I have another requirement, the decimal places in the amount field has to be dynamically set based on the currancy we are using for that row, so I have written small C program to do that and called it in transformer, it warks great no doubt about that, but it degrades the perfornamce, since it is external routine to be called in the transformer, so wanted to see is there any way I can improve the performance by doing other work around.

Currently we have 31 amount fields of type Decimal(26,3) and have to use that function for all the 31 amounts. our number records are around 100 millian and it takes around 55 to 65 minutes to export data into the file based on the load on the box. We use the file because we have to transfer the data into other system on other box. So can not use dataset.

Any thought would be appreciated.

Thanks
Arvind,

Posted: Fri Oct 19, 2007 10:00 am
by meemaza
ray.wurlod wrote:The leading zeroes are an artifact of the data viewer. They are not really there when a decimal data type is stored. Ignore them - they are included to prove that the precision and scale are being a ...
Thanks Ray,
I could not able to read your reply since was under "premium contents". however I know that these fields are never stored into a decimal data type, just wanted to work around to get away with that, I have used several funcionality such as DecimalToString and "Fix_Zero" option, but it does not help me lot.

I have to return empty when ever amount is 0.00 so that does not help me.

Even I tried to use basic transformer to use the Oconv function and it gave me what I wanted with the proper format, but it is too slow!

Thanks
Arvind,