Item Rule Syntax

Item Rules are used in defining and validating integrity constraints on item attributes, and in assigning values to attributes.

Basic Rule Formation

Item rules consist of expressions, operators, and functions. Most expressions reference the value of an item attribute.

Rules can encapsulate a single integrity constraint. The following example checks that a given attribute is less than another:

[Item].[Physical Attributes].[Unit Weight] <= [Item].[Logistics].[Shipping Weight]

In other words, the net weight of an item always has to be less than or equal to the shipping weight.

Rules can define assignment formulas. The following example is used in assigning a value for a "Daily Waste Percent" attribute:

[Item].[Logistics].[Total Waste Percent] / [Item].[Inventory].[Shelf Life Days]

In the preceding example, the daily waste percent is the total waste percent divided by the shelf life in days.

Attribute Expressions

You access the value of an attribute by appending its name to its entity and attribute group, separated by a delimiter. The delimiter is the period character (.). You can use the display name of an attribute naming element, which can include space characters, but must be enclosed in single brackets.

Following is the syntax of an attribute expression:

[<Entity Name>].[<Attribute Group Name>].[<Attribute Name>]

When referencing descriptive flexfields, use the segment code, as in the following example:

[ChangeHeader].Flexfield[Product__Line]

UOM Expressions

If an extensible flexfield attribute definition includes a unit of measure (UOM), you can access the unit by appending UOM to the attribute expression. The syntax is:

[Item].[<EFF Attribute Group Name>].[<Attribute>].UOM
For example:
[Item].[Semiconductor Details].[Capacitance Numeric].UOM

For seeded item attributes, you can access the UOM using the syntax:

[Item].[<Attribute Group Name>].[<Attribute> Unit of Measure]

For example, the following expression may return kg if the attribute's UOM is kilograms:

[Item].[Physical Attributes].[Weight Unit of Measure]

All comparisons between amounts are automatically adjusted to account for different UOMs. Accessing the UOM of an attribute explicitly should not be necessary for comparison purposes.

Null Values

Rules that reference attributes that have no value (also called a null value) are ignored. Expressions that evaluate to NULL are ignored.

That means that you never need to code Validations like:

if (not isnull(Item.PhysicalAttributes.Weight)) then Item.PhysicalAttributes.Weight <= 10

The "if" part is redundant, since if Weight was NULL the validation would be ignored. If you do want to check that an attribute has a non-null value, use the isnull function, which can be used to check that an attribute has a value entered.

Boolean Expressions

Boolean expressions are those that return TRUE, FALSE or null. Boolean expressions can be used in If Expression and Validation Condition fields of the Edit Rule Set page. Use logical and comparison operators and functions in Boolean expressions.