Query in the 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
Immaculin
Participant
Posts: 5
Joined: Mon Jun 04, 2007 12:33 am

Query in the transformer

Post by Immaculin »

Hi

If ((IsNull(DSLink2.DUNS_LEVEL_1) =0) And (IsNull (DSLink2.DUNS_LEVEL_2) = 0) And (IsNull( DSLink2.DUNS_LEVEL_3) =1)) Then DSLink2.LEGACY_CD Else DSLink2.DUNS_LEVEL_3 .
In the above query it checks that if my first level is not null and my second level is not null and my third level is null, it populates the required field in the third level. Is the above query right?. for eg

level1 level2 level3
1234 2545 null

then output should be

level1 level2 level3
1234 2545 7894 if dslink.legacy_cd=7894.

thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You don't need all those parens and shouldn't be checking for 0 or 1, simply let the booleans sort themselves out naturally:

Code: Select all

If Not(IsNull(DSLink2.DUNS_LEVEL_1)) And Not(IsNull (DSLink2.DUNS_LEVEL_2)) And IsNull(DSLink2.DUNS_LEVEL_3) Then DSLink2.LEGACY_CD Else DSLink2.DUNS_LEVEL_3
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Or use the IsNotNull() function to check for not nulls and IsNull() function for nullability check
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ah... wasn't aware of the knotted version in the PX world. :wink:
-craig

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