Specialized Administration > Tailoring Business Objects > Object Initialization Rules Administration > Working with Object Initialization Rules > Specifying Rules > AttrConstraint Tag Syntax
  
AttrConstraint Tag Syntax
An XML document used for a rule can contain one or more AttrConstraint tags. Always nest the AttrConstraint tag within an AttributeValues tag.
Use the AttrConstraint tag to apply constraints that determine whether the user interface used to initialize an object of an object type has special display characteristics for any of the attributes associated with object. The rules that are available for setting constraints for a Windchill attribute are determined by the object type and context hierarchies that are in place. For details on how rules use these hierarchies, see Merging Rules to Create a Composite Rule.
The AttrConstraint tag syntax is as follows:
<AttrConstraint id="Windchill_object_attribute
"
algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<Value algorithm="constraint_algorithm"/>
algorithm_arguments
<Value algorithm="constraint_algorithm"/>
algorithm_arguments
</AttrConstraint>
Each Value tag shown in the AttrConstraint tag syntax contains a constraint algorithm that is applied to the user interface when the Windchill attribute field is displayed in the interface that creates the object. The object being created must be of the type identified when the rule was created.
When supplying only one constraint algorithm for processing in an AttrConstraint tag, the algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints" attribute in this tag is not required. However for consistency, GatherAttributeConstraints is included in all examples.
You can specify zero, one, or more Value tags that identify the algorithms to execute for applying constraints. Additionally, you include the any arguments (shown as algorithm_arguments) for those algorithms that have arguments.
For details on the algorithms, see Constraint Algorithms.
For example, use the following XML nested in the AttributeValues tag for the wt.doc.WTDocument object type to display the pregenerated default number:
<AttrConstraint id="number"
algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">
<Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue" />
</AttrConstraint>
Including no Value tags provides an empty constraint on the attribute, which then displays an empty input field in which a user can manually enter a value.
For an explanation of the constraint algorithms and information on how you can use multiple constraints together, see Constraint Algorithms.
Additionally, you can include optional XML attributes in the AttrConstraint tag to do the following:
Set the constraints specified as the absolute set of constraints to use in the composite rule.
Ignore the specified constraints for the object attribute when the value is inherited from the parent context.
For information about the supported attributes that can be included in the AttrConstraint tag, see Using Supported Types and Attributes.