Page 1 of 1

StageVariables:Null handling

Posted: Thu Oct 04, 2007 10:08 am
by Aquilis
all,

i'm using two stagevariables as mentioned below.
Stagvar1:
If ((IsNotNull(Column1)) or (IsNotNull(Column2)) Then '0' Else '-100'

Stagvar2:
If (IsNull(Column3)) Then '-Z' Else (If (IsValid('Date', StringToDate(Column3,"%yyyy%mm%dd"))) Then '0' Else '-200')


stagvar3:
If stagvar1<>0 Then stagvar1 Else If stagvar2<>0 Then stagvar2 Else'1'

when i validate more than one Columns in the Stagvar1: its Not producing expected result.If i validate only single column then its ok.I dont understand whats happening.I think its not supporting 'OR' statement itself.Everytime i am getting return value as '1',when i pass Null value into Column1 or Column2. what would be the problem. Suggest.

Re: StageVariables:Null handling

Posted: Thu Oct 04, 2007 12:02 pm
by Havoc
Aquilis wrote:all,

i'm using two stagevariables as mentioned below.
Stagvar1:
If ((IsNotNull(Column1)) or (IsNotNull(Column2)) Then '0' Else '-100'

Stagvar2:
If (IsNull(Column3)) Then '-Z' Else (If (IsValid('Date', StringToDate(Column3,"%yyyy%mm%dd"))) Then '0' Else '-200')


stagvar3:
If stagvar1<>0 Then stagvar1 Else If stagvar2<>0 Then stagvar2 Else'1'

when i validate more than one Columns in the Stagvar1: its Not producing expected result.If i validate only single column then its ok.I dont understand whats happening.I think its not supporting 'OR' statement itself.Everytime i am getting return value as '1',when i pass Null value into Column1 or Column2. what would be the problem. Suggest.
Didnt quite understand what you meant by 'validate more than one Columns'.

You have specified an Or condition in your first stage variable which will produce the following results :

Column1 = NULL,Column2 = <non null value>, return value = 1
Column1 = <non null value>,Column2 = NULL , return value = 1
Column1 = NULL,Column2 = NULL , return value = 0
Column1 = <non null value>,Column2 = <non null value> , return value = 1

I am not sure about your business requirement but maybe changing that 'Or' to 'And' should address your concern which will return a 1 only if both columns have a non null value.