Stuck on the codes

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
chowmunyee
Participant
Posts: 32
Joined: Wed Dec 28, 2005 9:02 pm

Stuck on the codes

Post by chowmunyee »

Hi,

I have stuck at here with few hours and my problem is....

i have 2 fields which is optional attribute which mean the data can be null characters.

attribute name attribute data type attribute mandatory/optional
A char(3) optional
B char(3) optional

The business rules is "either A OR B is mandatory"

table A (look up to trans)
|
v
source - > transformer

|
table B (look up to trans)

how i wrote for this code whereby if A having value then B can be no value/having value. if B having value, A can have value/no value but if 2 value empty then all rejected....

Thank you
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

In you transform stage you can handle this with constraints. The "good" output would if something like "ISNULL(In.ColA) + ISNULL(In.ColB) = 1". This works because a "true" is returned as a 1 and a "false" as a 0, so you can use normal math on the returned values. If your answer is more than 1 (i.e. both are null) or less than 1 (both have non-null values) then the row won't go down that link. You can create a reject output to handle those cases.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

This can be posted in Server Forum.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply