Not accepting NULLS while using IsValid or NUM functions

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
lak4u
Participant
Posts: 43
Joined: Mon Nov 03, 2008 10:00 pm

Not accepting NULLS while using IsValid or NUM functions

Post by lak4u »

If I am using IsValid or NUM functions for cheking Integers it does not allowing NULL values,please help.

Thanks
laknar
Participant
Posts: 162
Joined: Thu Apr 26, 2007 5:59 am
Location: Chennai

Post by laknar »

first for null values first and then go for NUM Function

If IsNull(Columnname) then setnull() Else ......
Regards
LakNar
lak4u
Participant
Posts: 43
Joined: Mon Nov 03, 2008 10:00 pm

Post by lak4u »

laknar wrote:first for null values first and then go for NUM Function

If IsNull(Columnname) then setnull() Else ......
Thanks for reply but I tried this way too but still no use,I am not sure whre exactly the problem,please help
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Regard all Transformer stage functions as intolerant of null.

Please be specific about what you tried and what you mean by "doesn't work" (including any error message).

The approach that was suggested will work, provided that the Else clause is complete. You don't need SetNull() in the Then clause; the result when the source is null will depend on your particular business rules.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
lak4u
Participant
Posts: 43
Joined: Mon Nov 03, 2008 10:00 pm

Post by lak4u »

ray.wurlod wrote:Regard all Transformer stage functions as intolerant of null.

Please be specific about what you tried and what you mean by "doesn't work" (including any error message).

The approach that was su ...
Hi Ray,

My source is varchar with null values(example: 1234,NULL,4321,NULL)
Target is integer ..

if I use IsValid or NUM function transformer .I am getting only two values like 1234 and 4321..its ignoring NULL,NULL
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What if you use something like the following for an int8 result?

Code: Select all

If IsNull(InLink.TheString) Then -1 Else IsValid(InLink.TheString, "int32")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
lak4u
Participant
Posts: 43
Joined: Mon Nov 03, 2008 10:00 pm

Post by lak4u »

ray.wurlod wrote:What if you use something like the following for an int8 result?

Code: Select all

If IsNull(InLink.TheString) Then -1 Else IsValid(InLink.TheString, "int32")
...
Its created NULL value as '-1' and actual values all Zero's

0
-1
0
-1
0
-1
0
0
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Well, some progress has been made. Now you have to work out why the IsValid() function is reporting your "numeric" data not to be valid as 32-bit integers. Look for non-printing characters in the date. Try the IsValid() function with "uint32" as its second argument.
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