Bookshelf Home | Contents | Index | PDF

Comparison and Pattern Matching Operators

Comparison operators expect numeric operands. This means when you specify an item or arithmetic expression, the eConfigurator engine uses the quantity of the item or the value of the expression. These operators produce a logical result. This means the operator evaluates and compares the quantities of the operands and returns a true or false result.

The greater-than operator (>) is an example. The eConfigurator engine interprets the following top-level rule to mean the quantity of item A must be larger than the quantity of item B in the solution. The eConfigurator engine enforces this constraint by adjusting the quantity of A or B as needed to make sure that the constraint is always true.

>([A],[B])

When used as sub-expressions, comparison operators return true or false. For example, if the quantity of item A in the solution is not greater than the quantity of item B, the example above returns false. This is then acted on by the associated top-level expression.

Pattern matching operators compare two strings. You can test whether the strings are a match or a mismatch. Pattern matching operators return true or false.

Comparison operators are shown in Table 39.

Table 39.  Comparison and Pattern Matching Operators
Operator
Syntax
Properties

Greater than

>(A, B)

A and B can be items or sub-expressions.

Not less than

>=(A, B)

A and B can be items or sub-expressions.

Equals

==(A, B)

A and B can be items or sub-expressions.

Not equal to

!=(A, B)

A and B can be items or sub-expressions.

Not greater than

<=(A, B)

A and B can be items or sub-expressions.

Less than

<(A, B)

A and B can be items or sub-expressions.

Selected

sel(A)

Returns true if A is positive, false if A is not. Same as >(A, 0). If used as top-level expression, means that A must be in the solution in any quantity. A can be an item or sub-expression.

Pattern match

Like(A, B)

Result is true when string A pattern-matches string B. Similar to Siebel search specification. For example B could be "Pentium*". Note capitalization of operator. A and B must be constants. For example, A and B cannot be attribute names.

Pattern mismatch

NotLike(A, B)

Result is true when string A does not pattern-match string B. Similar to Siebel search specification. For example B could be "Pentium*". Note capitalization of operator. A and B must be constants. For example, A and B cannot be attribute names.

Multiple Operands for Comparison Operators

You can use multiple operands in rules containing comparison operators. For example, you could write the following rule:

>([A],[B],[C])

This syntax is interpreted by the eConfigurator engine as if you had written two rules:

>([A],[B])

>([A],[C])

Note that [A] is the first operand in both the rules. The eConfigurator takes the first operand and creates expressions between it and each remaining operands. There are no limitations on the number of operands you can use in this type of expression.

Note that the expression are interpreted by the eConfigurator engine as pairs that always include the first operand. This type of expression does not create implied constraints between other operands. For example, you write the following rule:

!=([A],[B],[C])

This rule expression is interpreted as A !=B and A!=C. It does not imply that
B !=C.