In addition to numeric expressions, you may use logical operators to create Boolean expressions that compare two numeric expressions yielding a result of True or False. These expression may be used in IF…THEN statements and condition fields to make specific decisions in the model based on the values of two numeric expressions.
The following table lists and illustrates the use of Boolean operators to create Boolean expressions.
|=||equal to||a_Weight = 2.5|
v_Total_Pieces = 50
|>||greater than||a_Weight > 2.5|
v_Total_Pieces > 50
|<||less than||a_Weight < 2.5|
v_Total_Pieces < 50
|<>||not equal to||a_Weight <> 2.5|
v_Total_Pieces <> 50
|>=||greater than or equal to||a_Weight >= 2.5|
v_Total_Pieces >= 50
|<=||less than or equal to||a_Weight <= 2.5|
v_Total_Pieces <= 50
|AND||both expressions||a_Weight = 25 AND v_Total = 30|
v_Total >= 20 AND v_Total <= 30
|OR||Done or both expressions||a_Weight > 5 OR v_Total <= 20|
v_Total = 30 OR a_Weight =15
Examples of Boolean Expressions
You may use simple or compound numeric expressions on either side of the Boolean operator.
IF v_Total_Pieces > 5 * a_Pkg_Qty THEN…
IF (a_Weight + 5) <= (a_Pkg_Qty / 2) THEN…
IF N(25, 4.8) + a_Weight = v_Total_Pieces – 10 THEN…
IF a_Weight >= v_Total_Pieces AND a_Pkg_Qty > 20 THEN…
IF v_Total_Pieces = a_Pkg_Qty OR a_Pkg_Qty > 35 THEN…
As in conventional mathematics, ProcessModel evaluates expressions with more than one operator according to certain rules of precedence. Expressions with more than one operator are evaluated from left to right in the following order:
1. Terms inside parenthesis: ( )
2. Multiplication: *; and Division: /
3. Addition: +; and Subtraction: –
4. Equalities and Inequalities: =, <>, >, >=, <, <=
- What are Numeric Expressions?
- What are Boolean Expressions?