Handling nulls in Stage Variables In Transformer

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
ds_raman
Participant
Posts: 21
Joined: Tue Nov 27, 2007 3:10 pm

Handling nulls in Stage Variables In Transformer

Post by ds_raman »

Hi
There are null values coming in from source and i need to set a flag for this field(Empid), but when i try to check if Empid is null in Stage variable, the records get dropped, and the same applies for date of birth field, DOB,
Is there anyother way in Transformer by making use of Stage Variables i can set the Flag to "N" for Null Values
Thanks and regards
raman
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

Check the nullability of your target fields. Post the derivations here. Are you trying to substitute N for a NULL, or are you just checking for null and populating the Flag field to N?
It is our choices that show what we truly are, far more than our abilities - J.K.Rowling
ds_raman
Participant
Posts: 21
Joined: Tue Nov 27, 2007 3:10 pm

hi

Post by ds_raman »

Maveric wrote:Check the nullability of your target fields. Post the derivations here. Are you trying to substitute N for a NULL, or are you just checking for null and populating the Flag field to N?
I am trying to substitue "N" for nulls
Thanks and regards
raman
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

Can you post your derviation?
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

What is the Data type of your input and output fields? And Why use stage variables? A simple derivation like

Code: Select all

 If IsNull(In.EmpID) Then "N" Else In.EmpID 
would do. This will work only if the data type is char or Varchar. Only then would you be able to substitute the value N.
It is our choices that show what we truly are, far more than our abilities - J.K.Rowling
ds_raman
Participant
Posts: 21
Joined: Tue Nov 27, 2007 3:10 pm

HI

Post by ds_raman »

balajisr wrote:Can you post your derviation?
Stage Variable i am using Null_F=NullToValue(EmpIdExist,'N')

And on the Constraint if Null_F='N' then the records are routed to Error Link
Thanks and regards
raman
ds_raman
Participant
Posts: 21
Joined: Tue Nov 27, 2007 3:10 pm

Thanks but i need to route the records

Post by ds_raman »

Maveric wrote:What is the Data type of your input and output fields? And Why use stage variables? A simple derivation like

Code: Select all

 If IsNull(In.EmpID) Then "N" Else In.EmpID 
would do. This will work only if the data type is char or Varchar. Only then would you be able to substitute the value N.
Thanks but i need to route the recors to Error Link, so i have to make use of StageVariables, Kindly suggest how i can solve this using StageVariables, and route the records based on the value contained in StageVarialble (Null_F)
Thanks and regards
raman
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Thanks but i need to route the records

Post by chulett »

ds_raman wrote:Thanks but i need to route the recors to Error Link, so i have to make use of StageVariables
:? No, you don't have to use stage variables. You can use your null check directly in the constraint that 'routes' the records.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ds_raman
Participant
Posts: 21
Joined: Tue Nov 27, 2007 3:10 pm

Re: Thanks but i need to route the records

Post by ds_raman »

chulett wrote:
ds_raman wrote:Thanks but i need to route the recors to Error Link, so i have to make use of StageVariables
:? No, you don't have to use stage variables. You can use your null check directly in the constraint that 'routes' the records.

Solved the problem.,
Thank You,
Thanks and regards
raman
ds_raman
Participant
Posts: 21
Joined: Tue Nov 27, 2007 3:10 pm

Re: Thanks but i need to route the records

Post by ds_raman »

chulett wrote:
ds_raman wrote:Thanks but i need to route the recors to Error Link, so i have to make use of StageVariables
:? No, you don't have to use stage variables. You can use your null check directly in the constraint that 'routes' the records.

Solved the problem.,
Thank You,
Thanks and regards
raman
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Time to mark the post as Resolved, then.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply