Test for Range of Values

What if the mass is not limited to exact values, but instead can occur in several ranges of values? Consider the following examples:

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

We can change an existing rule to accommodate these ranges.

  1. Open the Rules Browser, and double-click Width_Rule to open the rule in the Edit Rule dialog box.
  2. Modify the rule as shown.

    Copy Code Block

    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

    With these changes, we check for a range of values in each If or Else If statement.

  3. Click OK to close the Edit Rule dialog box.

Remove the Multi-Value List from the Mass Parameter

As a last step, we modify the User parameter mass, which is currently a multi-value parameter. We can remove the multi-value characteristic associated with this parameter by editing the multi-value list.

  1. Open the Parameters dialog box.
  2. Right-click an empty cell in the mass row, and select Edit Multi-Value List from the context menu.
  3. Select all the values in the Value list, and then click Delete.
  4. Click OK to accept the change. Notice that the mass parameter no longer has a multi-value list to select from.

Test the Modified Rule

  1. In the Parameters dialog box, enter a mass value of 75. The width of the bracket is set to 1 inch.
  2. Change the mass to 150. The bracket width is now 2 inches.

    (1) mass=75, width=1 in (2) mass=150, width=2 in

  3. Experiment further. By changing the mass to 250, the width changes to 3 inches. When mass is 350, the width of the bracket is 4 inches. Entering a mass value greater than 400 results in bracket width of 6 inches. Verify it by setting the mass to 1500.
  4. Change the mass back to 150, then click Done.
  5. Save and close bracket.ipt.

Previous | Next