If – Setting conditions

General

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
2  
3    child:Part;
4    parent:BomNode;
5    
6    if {parent.id == child.parentid && parent.productid == child.productid; }
//if partNumber of part1 equals partNumber of part2 the BooleanExpression is evaluated to true.
7
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:

BoM-Kit

Was this article helpful?

Related Articles