How to use logical or in custom rules?

Hi there,

(rule prim_sek
(constraint clearance (min 4.5mm))
(condition “A.NetClass == ‘Sek*’ && B.NetClass == ‘Default’ || ‘P-400V’”))
→ No errors, but only the ‘Default’ rule will be observed

Swapping ‘default’ with ‘P-400V’ → only ‘P-400V’ rule will be observed
B.NetClass == ( ‘Default’ || ‘P-400V’)")) → Syntax Error

This works as reqired:
(rule prim_sek
(constraint clearance (min 4.5mm))
(condition “A.NetClass == ‘Sek*’ && B.NetClass == ‘Default’ || B.NetClass == ‘P-400V’”))

Bug or right behavior?

You can’t OR together two strings, so the behavior is correct. You have to apply the logical operators to boolean expressions (for example, a string comparison with ==)

2 Likes