Decimal value (00000000000000000000.000000) to blank it

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

Decimal value (00000000000000000000.000000) to blank it

Post by srini.dw »

Hi,

Decimal values from source getting as 00000000000000000000.000000(DECIMAL (26,6)).If it's value of integer part and also decimal part is 0(ZERO) then convert it as blank("").

Could you please let me know how to achieve this logic?

Regards,
Srini
Satwika
Participant
Posts: 45
Joined: Mon Jan 02, 2012 11:29 pm

Re: Decimal value (00000000000000000000.000000) to blank it

Post by Satwika »

Multiply with 10,00,000 and convert from decimal to integer and check the value is zero. If Yes, populate "" else value.
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

Re: Decimal value (00000000000000000000.000000) to blank it

Post by srini.dw »

Satwika wrote:Multiply with 10,00,000 and convert from decimal to integer and check the value is zero. If Yes, populate "" else value.
1.if value 0000000000000000000.001000 then - final value as 0.001000
2.if value 0000000000000001000.000000 then - final value as 1000
3.if value 0000000000000000000.000000 then - final value as ""(blank)

Whatever your suggestion would work out 2 & 3.What about condition 1?

Regards,
Srini
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post by BI-RMA »

How about: If Columnname = 0 then "" Else Columnname ?
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
Satwika
Participant
Posts: 45
Joined: Mon Jan 02, 2012 11:29 pm

Re: Decimal value (00000000000000000000.000000) to blank it

Post by Satwika »

srini.dw wrote:Whatever your suggestion would work out 2 & 3.What about condition 1?
Even For 1st condition also it works . if you are multipling with 6 zeros then it replaces the decimals and makes it complete integer value. the 1st one's output is 1000. it is greater than 0 . so not required to replace with "".

Multplication and all checks do in stage variable and replace blank to the Original column.
harishkumar.upadrasta
Participant
Posts: 18
Joined: Tue Dec 25, 2012 10:39 pm
Location: Detroit,MI

Post by harishkumar.upadrasta »

please try this logic also


if( decimaltostring( input_decimal_field,"suppress_zero")=0) then '' else input_decimal_field
Harish
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is an environment variable that allows the otherwise illegal situation of all zero bits in a decimal data type.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply