Originally posted by: SystemAdmin
I'm not sure I understand the question well enough to tell you what to do, but I see some differences between the rule that works and the ones that don't that might be the difference you need to understand.
In your original rule, you say
IF(LEFT(Text Data General Element:ObjectValue General Choice:In1,3)="035" & MID(Text Data General Element:ObjectValue General Choice:In1,22,2)=X12 Elements:CodeConversionGroup Groups:In3,EDIFACT Elements:CodeConversionGroup Groups:In3)
The characteristic of that rule that's important to me is the fact that the rule returns NONE when things don't match. For each execution of the rule, we'll look at one Text Data General Element, and one X12 Element; if the first three characters of Text Data General Element are "035", and the later two characters of it match the X12 Elements that we're looking at, the result will be the EDIFACT Elements in the same CodeConversionGroup Groups:In3; otherwise, the result of the rule will be NONE.
When the result of the mapping rule is NONE, the rule gets executed again, with a different set of ingredients. So if the result of the first execution is NONE, the rule will be executed again with a different Text Data General Element or a different X12 Element. This will continue until the result isn't NONE, or we run out of unique sets of ingredients.
In your second rule, the first part of the rule is the same (the "035" part), but the next part now says "if those later characters aren't equal to the X12 Element that we're looking at, output a literal". So any time the later characters don't match the X12 Element we're looking at, we'll get a non-NONE result, and we won't look at other things. Any time the later characters don't match the FIRST X12 Element, we're finished with the rule right away!
The third rule has a similar problem: this time, if everything matches, we'll explicitly produce NONE (and run the rule again until stuff doesn't match), but if something doesn't match, we'll produce the literal.
It isn't obvious that the rule is executed multiple times in the original rule; to prove it to yourself, make the output object of the rule a series, and make the output not be NONE:
whatever (s) = IF(LEFT(Text Data General Element:ObjectValue General Choice:In1,3)="035" & MID(Text Data General Element:ObjectValue General Choice:In1,22,2)=X12 Elements:CodeConversionGroup Groups:In3,EDIFACT Elements:CodeConversionGroup Groups:In3, "Didn't Match")
You'll see a bunch of "Didn't Match" before you'll get your old output.
Because of this behavior, it's tricky to "use negative logic".
#DataExchange#IBMSterlingTransformationExtender#IBM-Websphere-Transformation-Extender