If – Setting conditions


The Java-like attribute condition if in the pattern part allows further restrictions for the applicability of a rule. The pattern can only match if the BooleanExpression is evaluated to true.

If you want to use an if-condition within a sequence you can visit this article.

Example code:

1  rule createBOMHierarchy{      //LHS
3    child:Part;
4    parent:BomNode;
6    if {parent.id == child.parentid && parent.productid == child.productid; }
//if partNumber of part1 equals partNumber of part2 the BooleanExpression is evaluated to true.
8    modify{                      //RHS
9       parent -:Contains-> child;
10   }
11 }

This code example can be found in our Soley Studio Tutorial.

How to use it:

More Examples can be found in these Packages:


Was this article helpful?

Related Articles