Can i write multiple conditions in constraint in transformer .
example :
link2.custid<>'1253' or link2.custid<>'4859'
when i write like this the filter is not being applied when i use only one condition like
link2.custid<>'1253' then its working fine .
What is the mistake in this and can you help me with the syntax
Transformer Constraint
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 9
- Joined: Wed Dec 07, 2011 3:01 pm
- Location: SEATTLE
-
- Premium Member
- Posts: 301
- Joined: Thu Jul 14, 2005 10:27 am
- Location: Melbourne, Australia
- Contact:
To apply one constraint AND another constraint you should use an AND clause between the conditions!
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
-
- Premium Member
- Posts: 5
- Joined: Mon Apr 09, 2012 8:44 am
- Location: Chennai
I am wondering in which case your condition will fail.
Let us take one positive and one negitive scenario, assuming the input data is as expected.
If the input Custid ='1253' then Condition one fails and condition 2 pass so the result is fail or pass = pass.
If the input Custid ='4859' then Condition one pass and condition 2 fails so the result is pass or fail = pass.
If the input Custid ='1111' then Condition one pass and condition 2 pass so the result is pass or pass = pass.
Hope the logic is wrong.
Its better practice to use the Trim function while using the char fields in conditions.
Always check the input data should not have junk values which can occur while conversion of varchar to char
Let us take one positive and one negitive scenario, assuming the input data is as expected.
If the input Custid ='1253' then Condition one fails and condition 2 pass so the result is fail or pass = pass.
If the input Custid ='4859' then Condition one pass and condition 2 fails so the result is pass or fail = pass.
If the input Custid ='1111' then Condition one pass and condition 2 pass so the result is pass or pass = pass.
Hope the logic is wrong.
Its better practice to use the Trim function while using the char fields in conditions.
Always check the input data should not have junk values which can occur while conversion of varchar to char
You are facing a logic problem (logic as in TRUE/FALSE, ANDs and ORs). A constraint must evaluate to TRUE in order for a row to be written to the link, and must evaluate to FALSE in order for a row to NOT be written to the link.
You provided the following logic:
Under what conditions will it evaluate to FALSE? Both of the comparisons must evaluate to FALSE in your logic. Can that happen?
Regards,
You provided the following logic:
Code: Select all
link2.custid<>'1253' or link2.custid<>'4859'
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
Yes, you can have many conditions using Or, And, or both. As mentioned, you've used an Or when you most likely should have used an And. Your syntax is correct. Add parenthesis to help group them if you have many, just like any programming language.
Choose a job you love, and you will never have to work a day in your life. - Confucius