How to trap null date value?

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
egsalayon
Participant
Posts: 27
Joined: Sun Sep 23, 2007 9:21 pm

How to trap null date value?

Post by egsalayon »

In a transformer stage, I need to trap null date values. I use IsNull(input_column). It recognizes that it is no null values, but actually there is. How can I go about this, thank you very much
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If the IsNull() function does not return TRUE, then you don't have a null value in the column. Try a test job and set a date to a null value using SetNul() then test it again with IsNull() and you will see what I mean.
egsalayon
Participant
Posts: 27
Joined: Sun Sep 23, 2007 9:21 pm

Post by egsalayon »

ArndW wrote:If the IsNull() function does not return TRUE, then you don't have a null value in the column. Try a test job and set a date to a null value using SetNul() then test it again with IsNull() and you wil ...
But if I write it to a table or dataset and view it, it will display NULL
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Perhaps I misunderstood what you would like to do. Could you explain what you want to write when the date is null?
vkhandel
Participant
Posts: 35
Joined: Wed Oct 04, 2006 12:12 am
Location: Pune

Re: How to trap null date value?

Post by vkhandel »

Can you try to trim the input field first and then check with IsNull() function as shown below -
IsNull(Left(Trim(input_column_name),Len(Trim(input_column_name))))
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

vkhandel - that would abort if the field were null, and I thought that the field was a "date" type, which cannot be trimmed in any case.
pranay
Participant
Posts: 20
Joined: Mon Jan 09, 2006 3:34 pm

Post by pranay »

i also have faced this problem before, what i did is used a If condition something like this to test for the null value, u might use a compare function or a len(trim(col_name) function. Let me know if it solved your problem or else i can provide u the exact if condition.

if len(trim(Lnk_Concat_Xfm4.Claim_Type)) = 0 then 1234567890 else if Lnk_Concat_Xfm4.Claim_Type = '\0' then 2222222222 else if Lnk_Concat_Xfm4.Claim_Type = '' then 3333333333 else if IsNull(Lnk_Concat_Xfm4.Claim_Type) Then 4444444444 else If
Len(Trim( Lnk_Concat_Xfm4.Claim_Type )) = 0 Then 555555555
Else If Compare(Lnk_Concat_Xfm4.Claim_Type,'') Then 666666666
else 'Else'
ArndW wrote:Perhaps I misunderstood what you would like to do. Could you explain what you want to write when the date is null? ...
Pranay
Seatte, WA
OddJob
Participant
Posts: 163
Joined: Tue Feb 28, 2006 5:00 am
Location: Sheffield, UK

Post by OddJob »

The above example is liable to cause problems... if Lnk_Concat_Xfm4.Claim_Type does contain null the first trim will not be happy and the record will get dropped.
Post Reply