Page 1 of 1

Stuck on the codes

Posted: Thu Aug 17, 2006 2:35 am
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

Posted: Thu Aug 17, 2006 2:55 am
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.

Posted: Thu Aug 17, 2006 4:20 am
by kumar_s
This can be posted in Server Forum.