3

I have a condition that is essentially A and (B or C or D or...). So for the rule to fire condition A has to always be met. And on top of that, one condition of either B or C or D etc.

I can't seem to get this into the rule though, or takes precedence over and (as it does in programming) and there's nothing I can do about it?

I've tried to manually edit the XML to no avail.

2
  • The site requires tags, but I don't have reputation yet to add a insert-options tag yet and my understanding is that the rules-engine actually isn't what's being used for the insert options rules?
    – asontu
    Mar 26, 2019 at 19:16
  • 1
    Your question is tagged correctly, since your question is more specific to how the rules engine works and how to manipulate it, rather than what you are using the rules engine for to manipulate insert options in your case. Mar 26, 2019 at 19:29

1 Answer 1

4

You are right. OR takes precedence. You can try (A and B) or (A and C) or (A and D) rule:

enter image description here

where true would be your A condition, and template rules would be your B, C and D.

Yeah, I know it's repeating A condition for every OR part but I don't think there is any better solution unless you create a predefined rule with the whole B or C or D part and then you can use A and BCD where BCD is a

where [predefined] rule is true

1
  • 1
    I'm gonna look into the predefined rule. My A rule is a regex that might need small adjustments in the future so I'd prefer not having it duplicated 4 times. The BCD is gonna expand in the future to be around 12 conditions, meaning the regex would be duplicated 12x...
    – asontu
    Mar 27, 2019 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.