Testing the iLogic Rules for Ranges of Values
What about cases where mass is not limited to the exact values but may occur in several ranges of values? The following example will illustrate this case.
Mass Range | Width |
Less than or equal to 100 | 1 in |
Greater than 100 but less than or equal to 200 | 2 in |
Greater than 200 but less than or equal to 300 | 3 in |
Greater than 300 but less than or equal to 400 | 4 in |
Greater than 400 | 6 in |
Let’s modify an existing rule. Open the iLogic Tree Editor, and double-click on Width_Rule to open it in the Rule Editor.
Modify the rule as follows:
If mass <= 100 Then
bracket_width = 1
ElseIf mass > 100 And mass <= 200 Then
bracket_width = 2
ElseIf mass > 200 And mass <= 300 Then
bracket_width = 3
ElseIf mass > 300 And mass <= 400 Then
bracket_width = 4
Else
bracket_width = 6
End If
bracket_width = 1
ElseIf mass > 100 And mass <= 200 Then
bracket_width = 2
ElseIf mass > 200 And mass <= 300 Then
bracket_width = 3
ElseIf mass > 300 And mass <= 400 Then
bracket_width = 4
Else
bracket_width = 6
End If
Here, we are checking for a range of values in each of the If statements. Click OK to close the Rule Editor.
iLogic Tutorial Navigation
1 – 2 – 3 – 4 – 5 – 6 – 7 – 8 – 9 – 10 – 11 – 12 – 13 – 14 – 15 – 16 – 17 – 18 – 19 – 20