Check for an Integer and null

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
vilasini
Participant
Posts: 32
Joined: Sun Dec 09, 2007 11:48 pm

Check for an Integer and null

Post by vilasini »

Hi Friends,

I have one field which is Varchar datatype in source and I need to check if it is not null and if it not an integer I have to set it to null else populate the same and write error msg.But my output column is an Integer and I have used If IsNotNull(input.field) and Num(input.field) in stage variable(sv) and
in output column :If sv then input.field else 0.

and I also tried in other way round,eventhough I am getting the warning like this.

APT_CombinedOperatorController(4),3: Null string argument.

I am not using basic trnasfomer.

Can anyone help me how to check for an Integer of varchar datatype and numeric.

Thanks in Advance
Anju
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What exact derivations have you used, please copy & paste them since the data in your post isn't complete.
stefanfrost1
Premium Member
Premium Member
Posts: 99
Joined: Mon Sep 03, 2007 7:49 am
Location: Stockholm, Sweden

Post by stefanfrost1 »

Remember that a stage varible cant contain NULLs so a tip is to first convert any null to something else and use that stage varible in you derivation later.

Usually that warning indicates that you are evalulating a column which has null and that operation does not allow NULLs
-------------------------------------
http://it.toolbox.com/blogs/bi-aj
my blog on delivering business intelligence using agile principles
vilasini
Participant
Posts: 32
Joined: Sun Dec 09, 2007 11:48 pm

Post by vilasini »

Thanks for your response.

I have tried in ouput column derivation :
If NOT(ISNULL(input.field)) Then Num(input.field Else NullToZero(input.field).

I got the same warning and again I tried with
If NOT(ISNULL(input.field)) Then StringTodecimal(input.field,"round_inf") Else NullToZero(input.field)

So I got conversion from string to deciaml warning.

Can anyone suggest me on this.

Anju
vilasini
Participant
Posts: 32
Joined: Sun Dec 09, 2007 11:48 pm

Post by vilasini »

Thanks,its working fine as I have used other functions.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What 'other functions'? Please come back, mark the thread as Resolved and let us know how it was resolved - this helps people right away and future searchers benefit as well. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
vilasini
Participant
Posts: 32
Joined: Sun Dec 09, 2007 11:48 pm

Post by vilasini »

I have used NOT(IsNull(AsInteger(inputfiled)))
Post Reply