Page 1 of 1

Not accepting NULLS while using IsValid or NUM functions

Posted: Fri Dec 19, 2008 11:36 pm
by lak4u
If I am using IsValid or NUM functions for cheking Integers it does not allowing NULL values,please help.

Thanks

Posted: Sat Dec 20, 2008 12:20 am
by laknar
first for null values first and then go for NUM Function

If IsNull(Columnname) then setnull() Else ......

Posted: Sun Dec 21, 2008 1:03 pm
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

Posted: Sun Dec 21, 2008 1:49 pm
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.

Posted: Sun Dec 21, 2008 8:51 pm
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

Posted: Sun Dec 21, 2008 10:02 pm
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")

Posted: Sun Dec 21, 2008 10:16 pm
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

Posted: Mon Dec 22, 2008 1:26 am
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.