- Code: Select all
If <All>
If <Any>
<Contents Contain Match><"A first pattern with 'Token'">
<Contents Contain Match><"A second pattern with 'Token'">
<Contents Contain Match><"A third pattern with 'Token'">
•Token <is not blank>
<Contents Contain Match><"A fourth pattern with 'Token'">
Now also assume an input/preview that causes "Token" to be matched as an empty string (i.e. blank) in the second pattern. The desire of the rule, by checking for <is not blank>, is to make the first top level "if" fail and allow the final match (fourth pattern) to set the token.
However, if in the first part the Token is matched up with the empty string, it gets bound to it, despite the overall condition (if) failing. Consequently the match in the fourth pattern will not happen (even though matching text is available) because the Token is already bound to a value (although be it the empty value).
I would suggest that token bindings to values should only happen if the condition it is in is part of producing a passing/true value all the way up to passing the whole rule. For the purpose of "Preview" one could still display a green check and show a value for the individual condition, but
- the actual binding in the next level up where that condition (typically an "If") has a red cross should not show there (and I believe currently clicking on such a red cross produces no view of bound tokens)
- the actual binding in the next level up where that condition (typically an "If") has a green check should not show there if this rule (the one level up one) is not part of the overall rule being true
Now, I realize that perhaps a workaround is to replace the line with the fourth pattern with
- Code: Select all
<If Any>
<If All>
• Token <is not blank>
<Contents Contain Match><"A fourth pattern with 'New Token'">
<If All>
• Token <is blank>
• Token <matches> <"'New Token' as ...">
This, however, seems excessive as a long term solution. I cannot see how what I propose breaks existing things from a logic perspective, but do realize that there might be (unlikely) scenarios where somebody actually counted on the old behavior. Yet I feel fixing this is "more" important as it is how one would logically expect things to behave.
Related, but not the same problem: In the current implementation, for the example rule above, there is a second, but minor problem if the match with the third pattern would also produce a match. Note that if the value was bound to the token in the second pattern, the third one should not produce a binding (and it does not), but when clicking on the green check for the <if-any> in the "custom attributes" I see two entries for the Token, but displaying the empty value. I would argue that any rule should only ever show a single attribute once with its bound value.