Bookshelf Home | Contents | Index | PDF

## Rule Examples

This section contains examples of how to use the eConfigurator Rule Assembly Language to create rules. Some of the rules show item names consisting of both the product name and its configuration ID (Cfg ID).

#### Basic Rules

The following table shows how create basic rules using Rule Assembly Language.

Rule Type

A requires B noncumulatively

`req(``A, B``)`

A requires B cumulatively

`inc(``A,B``)`

A excludes B

`excl(``A,B``)`

A provides the amount B to C

`inc(*(``A,B``),``C``)`

A consumes the amount B from C

`inc(*(``A``,-(``B``)),``C``)`

A's minimum quantity is B, enforced

`>=(``A,B``)`

A's maximum quantity is B, enforced

`<=(``A,B``)`

A recommends B

`rec(req(``A,B``))`

#### Boolean and Comparison Operators

The following table shows how to create rules using Boolean and comparison operators.

Rule Type

A AND B =C

`==(and(``A,B``),``C``)`

A OR B = C

`==(or(``A,B``),``C``)`

NOT (A = B)

`xor(``A,B``)`

(A < B) requires C

`req(<(``A,B``),``C``)`

(A <= B) requires C

`req(<=(``A,B``),``C``)`

(A = B) requires C

`req(==(``A,B``),``C``)`

(A != B) requires C

`req(!=(``A,B``),``C``)`

(A >=B) requires C

`req(>=(``A,B``),``C``)`

(A >B) requires C

`req(>(``A,B``),``C``)`

(A + B) contributes to C

`inc(+(``A,B``),``C``)`

(A - B) contributes to C

`inc(-(``A,B``),``C``)`

(A * B) contributes to C

`inc(*(``A,B``),``C``)`

(A/B) contributes to C

`inc(/(``A,B``),``C``)`

(A MIN B) contributes to C

`inc(min(``A,B``),``C``)`

(A MAX B) contributes to C

`inc(max(``A,B``),``C``)`

#### Rule Template Translations

Table 47 shows examples of the rule templates translated into Rule Assembly Language.

Table 47.  Rule Template Translations to Rule Assembly Language
Template
RAL Equivalent
Explanation

Constrain

con(>(Item A),1))

Constrain (quantity of
Item A> 1) to be true.

Constrain Conditionally

if(>(Item A), 1), >=
(Item B), 2), excl(Item C, Item D))

When (quantity of
Item A> 1)(quantity of Item B >= 2), otherwise Selection of Item C excludes selection of
Item D.

Constrain Product Quantity

==(Item A, 2)

The quantity of Item A = 2.

Consume

inc(*(Item A), -(1)), Resource B)

Each Item A consumes 1 from Resource B.

Exclude

excl(Item A, Item B)

Selection of Item A excludes selection of Item B.

Exclude List

excl(Item A, Item B, Item C))

Item A excludes (selection of Item B, selection of Item C).

Message

msg(>(Item A, 1))

When (Item A > 1), display this rule's description.

Preference

prefer(Item A, 1)

When possible, constrain Item A is selected to be true with a priority of 1.

Provide

inc(*(Item A), 1),
Resource B)

Each Item A provides 1 to Resource B.

Recommends

chk(req(Item A, Item B), "Item B is recommended")

Selection of Item A recommends selection of at least one Item B by displaying "Item B is recommended".

Requires

req(Item A, Item B)

Item A requires Item B.

Requires (Mutual)

eqv(Item A, Item B)

Item A requires Item B AND Item B requires Item A.

Constrain Attribute Value

==(@.[Class A]
([Item B]).[Day], "Monday")

The attribute Class A
"Item B" Attribute C = Monday.