Page 1 of 1

Changing field datatype from Double to Decimal

Posted: Wed Feb 13, 2008 12:01 pm
by Raamc
Hi All,
Im getting a field which contains count of records from Aggregator stage and I need to change that field datatype from Double to Decimal. Can any one help me out in this.

Thanks in advance.

Posted: Wed Feb 13, 2008 3:43 pm
by ray.wurlod
There is a global Decimal Output property in the Aggregator stage. As well any calculated column can override that with its own Decimal Output property. Specify precision,scale (that is, the precision value, a comma, and the scale value).

Posted: Thu Feb 14, 2008 5:54 am
by Raamc
Thanks for your responce Ray.
I dont find this 'global Decimal Output' sub-property in Aggregator for a column for which we take the 'count rows' as Aggregation Type.

Posted: Thu Feb 14, 2008 6:13 am
by ray.wurlod
Look more closely. It's there. Select the Aggregations folder and look in Available properties to add.

Posted: Thu Feb 14, 2008 10:48 am
by Raamc
Ray,
Im able to see that when I use Aggregation Type as calculation. But I dont find it for Aggregation Type=count rows.

Posted: Thu Feb 14, 2008 1:24 pm
by sud
Just go to the output tab in the aggregator and go to the columns tab and find out the output column you are talking about and change its datatype. :shock: :shock: :shock: :shock:

Posted: Thu Feb 14, 2008 1:53 pm
by dspxlearn
sud,

For the option 'Aggregation Type=count' in the aggregator stage the default datatype will be dfloat.
If you explicity change it to decimal, you will be getting a warning something like:

Code: Select all

Implicit conversion from source type "dfloat" to result type "decimal[38,0]": Possible range/precision limitation.

Posted: Thu Feb 14, 2008 2:00 pm
by sud
Right, but that warning should be okay. It is just a indicator that a conversion is happening so that you did not do the conversion unintentionally. And, message handlers can be used to get rid of it. And, this suggestion is only for someopne who is unable to find what Ray suggested

Code: Select all

goto Aggregator stage --> properties --> click on: Aggregations and select additional property Default to decimal

Posted: Thu Feb 14, 2008 2:08 pm
by dspxlearn
Ya. If we are going to use message handlers to suppress these kind of warnings, then its OK.

Raamc,
You have 2 options.
1. If you want a double datatype to be converted to decimal with a warning free job, keep the output datatype of the aggregator as double(default) and when you pass it to the later stages convert it to decimal by using the type conversion functions.
2. Explicitily change the datatype to decimal(p,s) and additionally supress the warning to log/demote the warning.

Posted: Thu Jun 06, 2013 8:14 am
by koolsun85
You will find in "Sum Output Column" with the property name "Decimal Output" where the default is 8,2 .

Posted: Fri Jun 07, 2013 10:05 am
by rsomiset
koolsun85 wrote:You will find in "Sum Output Column" with the property name "Decimal Output" where the default is 8,2 .
Hopefully dspxlearn has resolved this in the past 5 1/2 years. If not, this is the moment to go for it. :wink:

--
Raj