USE OF CONSTRAINTS in TRANSFORMER

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ririr
Participant
Posts: 84
Joined: Sun Apr 04, 2004 8:59 pm

USE OF CONSTRAINTS in TRANSFORMER

Post by ririr »

Guys,

I am having some hard time setting up the constraint at the transformer STAGE on the TARGET STAGE/LINK.

In the Contraint Window of the target transformer, I have created a constraint something like this:

DSLink3(SOURCE LINK)

If (DSLink3.COLUMN1=@NULL AND DSLink3.COLUMN2=@NULL AND DSLink3.COLUMN3=@NULL AND DSLinkUMN4.COLD=@NULL) then @NULL ELSE
DSLINK.COLUMN5(KEY ON THE TARGET TABLE).

All I am trying to do is if none of the columns have a value don't insert a record into the target table

Any help is appreciated!

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 do assignments in a Contraint, they should be an expression that equates to True or False.

Your If-Then-Else logic is meant to be used in a Derivation to set the values appropriately. To turn that into a Constraint to control when data is allowed to flow out of the link, do something like this:

Code: Select all

Not(IsNull(DSLink3.COLUMN1)) AND Not(IsNull(DSLink3.COLUMN2)) AND Not(IsNull(DSLink3.COLUMN3)) AND Not(IsNull(DSLink3.COLUMN4))
This will equate to TRUE only if there is data in all of the fields referenced. If any are null then it will equate to FALSE and nothing will go out that link. PS - don't forget that nothing is ever "equal to" null.
-craig

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