Page 1 of 1

Nulls in stage variables become 0/empty string in output

Posted: Thu Aug 09, 2007 2:59 am
by JeroenDmt
When I try to set a stage variable to a NULL value using SetNull(), and I use this stage variable in an output derivation for a nullable field, the output becomes 0 (integer field) or an empty string (string field).

For example if I have
- an integer stagevariable svar defined as '

Code: Select all

if 1=1 then SetNull() else SetNull()
'
- two nullable integer outputfields:
- f1: defined as

Code: Select all

svar
- f2: defined as

Code: Select all

if 1=1 then SetNull() else SetNull()
(same expression as for svar).

I would expect the result for both integer fields to be NULL.
However the output for f1=0, for f2 it is NULL.

Can a stage variable not be NULL, or what is my problem?

Re: Nulls in stage variables become 0/empty string in output

Posted: Thu Aug 09, 2007 4:25 am
by G SHIVARANJANI
Try to set the stage variable properties.

Posted: Thu Aug 09, 2007 4:27 am
by Raghavendra
check the properties of stage variables which should solve the issue.

Posted: Thu Aug 09, 2007 4:39 am
by battaliou
Stage variables are non-nullable.

Posted: Thu Aug 09, 2007 5:15 am
by Raghavendra
If stage variable property is non-nullable then we should not assign any null value to the stage variable. If we do we get a default value of 0.

Posted: Thu Aug 09, 2007 5:17 am
by JeroenDmt
Raghavendra wrote:check the properties of stage variables which should solve the issue.
..
If stage variable property is non-nullable then we should not assign any null value to the stage variable. If we do we get a default value of 0.
You make it sound like there is a property you can set to make a stage variable nullable. I can't find anything like that though.

So I assume battaliou is right and stage variables are always non-nullable indeed.

Posted: Thu Aug 09, 2007 5:21 am
by Raghavendra
Yes stage variables are always not nullable and so we cannot use setnull function in the stage variable. Sorry for creating the confusion.