Personalizzazione avanzata > Business Logic Customization > Business Rules > Business Rule Types > Attribute Rule
  
Attribute Rule
The attribute rule validates that the specified attribute rule configuration for an object type is valid. The object type is the only required input for an attribute rule configuration. The object type should be a wt.fc.Persistable type object. For example com.ptc.Waiver is a soft type of wt.change2.WTVariance.
<configs>
config name="objectType" value="com.ptc.Waiver"></config>
</configs>
The type string value can be specified using the just the type name or type external name (com.ptc.Waiver or WCTYPE|wt.change2.WTVariance|com.ptc.Waiver )
Subtypes of the specified object type can be excluded from attribute rule. For example, the following attribute rule configuration for object type WTVariance would exclude com.ptc.Waiver and com.ptc.Deviation type variances from being evaluated.
<configs>
<config name="objectType" value="wt.change2.WTVariance "></config>
<config name="excludedType" value="com.ptc.Waiver"></config>
<config name="excludedType" value=" com.ptc.Deviation "></config>
</configs>
To configure a condition to valid on an attribute of the specified object type the configuration name is the attribute name and the value is the condition. The following attribute configuration would check if a com.ptc.Waiver has an approved quantity between 10 and 100.
<configs>
<config name="objectType" value="com.ptc.Waiver"></config>
<config name="approvedQuantity" value="[10..100]"></config>
</configs>
The following is example where “weight” is the internal name of a soft attribute on some soft type of part.
<configs>
<config name="objectType" value="com.ptc.SoftTypePart"></config>
<config name="weight" value="<=100"></config>
</configs>
The following table shows the supported operations and object types supported in attribute rule configuration.
Operator
Value Types
Description
Example Conditions
>, >=, <, <=
Long, String, Date, Timestamp, FloatingPoint, FloatingPointWithUnits
Validates that the object attribute value is greater than, less than or equal to the value specified. The less than and greater than characters are reserved characters in the import load therefore the less than operator needs to be specified as ‘&lt;’ and greater than operator as ‘&gt;’.
>&gt;2012-01-12 00:00:00
<=&lt;=20.002
>&gt;=10
[0..10]
Long, String, Date, Timestamp, FloatingPoint, FloatingPointWithUnits
Validates that the object attribute value is within the specified range. If no minimum value in the range is specified the condition is equivalent to less than or equal to. The same for if the max value in the range is not specified the condition is treated a greater than or equal to.
[-10.09..10.09]
[2012-01-12 00:00:00..2012-02-12 00:00:00]
[..100]
[0..]
=, !=
Boolean, Long, String, Date, Timestamp, FloatingPoint, FloatingPointWithUnits
Validates that the object attribute value is or is not the value specified.
=true
&#33;=2012-02-12 00:00:00
=10.09
[A,B]
Boolean, Long, String, Date, Timestamp, FloatingPoint, FloatingPointWithUnits
Validates that the object attribute value is within the discrete set.
[true]
[2012-02-01 00:00:00,2012-02-15 00:00:00,2012-02-30 00:00:00]
[MAJOR,CRITICAL]
[10.01,10.02]
[10,100,1000]
SET
Boolean, Long, String, Date, Timestamp, FloatingPoint, FloatingPointWithUnits
Validates that the object attribute value is not null. Only the keyword SET is needed to specify the operation
SET
NOT_SET
Boolean, Long, String, Date, Timestamp, FloatingPoint, FloatingPointWithUnits
Validates that the object attribute value is null. Only the keyword NOT_SET is needed to specify the operation
NOT_SET
EQUALS
String
Validates that the object attribute value is the specified string.
EQUALS(MAJOR)
NOT_EQUALS
String
Validates that the object attribute value is not the specified string.
NOT_EQUALS(MAJOR)
BEGINSWITH
String
Validates that the object attribute value starts with a specified string.
BEGINSWITH(PN)
NOT_BEGINSWITH
String
Validates that the object attribute value does not start with a specified string.
NOT_BEGINSWITH(PN)
ENDSWITH
String
Validates that the object attribute value ends with a specified string
ENDSWITH(0)
NOT_ENDSWITH
String
Validates that the object attribute value does not end with a specified string
NOT_ENDSWITH(0)
CONTAINS
String
Validates that the object attribute value contains the specified string.
CONTAINS(PN0)
NOT_CONTAINS
String
Validates that the object attribute value does not contain the specified string.
NOT_CONTAINS(PN0)
LENGTH
String
Validates that the object attribute string length is within the specified range.
LENGTH(0..40)
LENGTH(0..)
LENGTH(..40)
Note that the system locale is used for the format of the dates and timestamps in the attribute condition.