Specialized Administration > Tailoring Business Objects > Object Initialization Rules Administration > Working with Object Initialization Rules > Rule Algorithms > Conditional Logic Algorithms > Conditional Logic Algorithm Example
  
Conditional Logic Algorithm Example
Use the following sample XML to specify conditional logic algorithms for setting different numbering schemes, depending on a specific attribute on a wt.part.WTPart object type:
<AttributeValues objType="wt.part.WTPart">

<AttrValue id="number"

algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">

<Value algorithm="wt.rule.algorithm.BooleanBranch">
<Value algorithm=" wt.rule.algorithm.StringInListTest ">
<Attr id="Existing_Attribute"/>
<Arg>A</Arg>
<Arg>B</Arg>
<Arg>C</Arg>
<Arg>D</Arg>
<Arg>E</Arg>
<Arg>F</Arg>
</Value>
<Arg>{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:10:0}</Arg>
<Arg>{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:5:0}</Arg>
</Value>

</AttrValue>

</AttributeValues>
In this example, the StringInListTest algorithm is used to test whether the part attribute value for " Existing_Attribute " is A, B, C, D, E, or F. If the part attribute value is in the list, then the algorithm returns TRUE; if it is not in the list, the algorithm returns FALSE.
The value returned by the StringInListTest algorithm determines which Arg element is used in the BooleanBranch algorithm:
A TRUE return value uses the first Arg element; in this case, {GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:10:0}.
A FALSE return value uses the second Arg element; in this case, {GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:5:0}.
For additional examples, you can download the out-of-the-box rules using the Download action from the right-click actions menu in the Object Initialization Rules table.
For additional explanations of the syntax required when using each conditional logic algorithms, see Conditional Logic Algorithms.