Conditional Logic Algorithm Examples
* 
In the examples that follow, some XML elements span multiple lines because of the page width. When coding an XML document, enter each XML element on one line.
The following XML uses both the BooleanBranch and EqualsTest algorithms to test for a specific type of part identified in the genericType attribute as "variant" and then to set a V prefix when numbering parts of this type:
<AttrValue id="number" algorithm="com.ptc.windchill.enterprise.revisionControlled.
server.impl.NumberGenerator">
<!-- add a V prefix for variant parts -->
<Value algorithm="wt.rule.algorithm.BooleanBranch">
<Value algorithm="wt.rule.algorithm.EqualsTest">
<Attr id="genericType"/>
<Arg>variant</Arg>
</Value>
<Arg>V</Arg>
<Arg></Arg>
</Value>
<!-- the sequence -->
<Arg>{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:10:0}</Arg>
</AttrValue>
The following example uses the BooleanBranch and IfContainerTypeEqualsProjectTest algorithms to set unique display constraints for numbers in a project or program. In this example, numbers in a project or program are generated and then displayed, but can be changed by the user; numbers in other contexts are generated and cannot be changed by the user:
<AttrConstraint id="number" algorithm="wt.rule.algorithm.BooleanBranch">
<Value algorithm="com.ptc.core.rule.server.impl.
IfContainerTypeEqualsProjectTest"/>
<Value algorithm="com.ptc.core.rule.server.impl.GatherAttribute
Constraints">
<Value algorithm="com.ptc.core.rule.server.impl.
GetServerAssignedConstraint"/>
</Value>
<Value algorithm="com.ptc.core.rule.server.impl.GatherAttribute
Constraints">
<Value algorithm="com.ptc.core.rule.server.impl.
GetServerAssignedConstraint"/>
<Value algorithm="com.ptc.core.rule.server.impl.GetImmutable
Constraint"/>
</Value>
</AttrConstraint>
Was this helpful?