(Example) Use Rules in a Form Control

This example shows how to create nested rules to show or hide a form control when a runtime app user selects an item from a drop-down list.

Background and Setup

Result

This example shows how to create the rules that are configured in the Customer Enquiry app to show or hide a form control based on a selection in a drop-down list.

On the Customer Enquiry Request form, in the How do you know about us? list, select Other.

The Other text box shows.


Advanced tab

If you select a different value from How do you know about us? list, the Other text box does not show.


Advanced tab

Prerequisites

Good to Know

  • Rules have 2 main parts:
    • Condition - The circumstances that trigger the rule. The When section of a rule specifies the conditions. Conditions have 3 parts:
      • Fields - One or more form controls that trigger or give the context for the condition.
      • Comparer - The operator to used to compare the two input values.
      • Rule Value - The value or variable that specifies the context for the rules.
    • Action - The results that occur if the conditions for the rule are true. The Then section of a rule specifies the actions.

Step 1: Create Rules

Create rules in a form control.

How to Start

  1. Click App Builder.

    Build Apps screen
  2. On the App Explorer screen, on the My App pane, click Customer Enquiry > Processes > Customer Enquiry > Forms > Task Forms > Customer Enquiry Form.

    Customer Enquiry Form

Procedure

  1. On the Customer Enquiry Form, put your cursor over the How do you know about us? Drop-Down List form control, and the form control toolbar shows.

    Form Control Toolbar
  2. Click Rules Rules icon.

    Rule icon
  3. On the Rule Builder screen, create a When statement that specifies the condition for the rule.

    In this example, the condition is that the value of the How do you know about us? list is not equal to Other:

    1. In the Fields section, drag How do you know about us? form control to the When section.

      Rule Builder screen
    2. In the Comparer list, select is not equal to.

      Rule Builder screen
    3. In the Rule Value list, select Other.

      Rule Builder screen
  4. Create a Then statement that specifies the action for the rule.

    This action only occurs when the first condition of the rule is true.

    In this example, the action is that the Other control is hidden (Hide Control) and optional (Set As Not Mandatory).

    1. On the Actions section, drag Hide Control to the Then section.

      Rule Builder screen
    2. In the Rule Value list, select Other.

      Rule Builder screen
    3. On the Actions section, drag Set As Not Mandatory to the Then section.

      Rule Builder screen
    4. In the Rule Value list, select Other.

      Rule Builder screen
  5. Click Add Rule.

    Rule Builder screen
  6. Create a When statement that specifies the condition for the rule.

    In this example, the condition is that the value of the How do you know about us? list is equal to Other:

    1. In the Fields section, drag How do you know about us? form control to the When section.

      Rule Builder screen
    2. In the Comparer list, select is equal to.

      Rule Builder screen
    3. In the Rule Value list, select Other.

      Rule Builder screen
  7. Create a Then statement that specifies the action for the rule.

    This action only occurs when the second condition of the rule is true.

    In this example, the action is that the Other control is visible (Show Control) and required (Set As Mandatory).

    1. On the Actions section, drag Show Control to the Then section.

      Rule Builder screen
    2. In the Rule Value list, select Other.

      Rule Builder screen
    3. On the Actions section, drag Set As Mandatory to the Then section.

      Rule Builder screen
    4. In the Rule Value list, select Other.

      Rule Builder screen
  8. Select Execute Rules Independently.

    This causes the form to execute each condition that is true as if it were a separate rule.


    Rule Builder screen
  9. Select Execute Rules On Form Load Also.

    This causes the eForm to execute the rule when the form loads in the web browser.


    Rule Builder screen
  10. Click OK.

    The Customer Enquiry Form shows.


    Customer Enquiry Form

Step 2: (Optional) Check Your Configured Rules

Check rules you configured for How do you know about us? drop-down list in Customer Enquiry Form.

Procedure

  1. Click Preview Perspective View icon > PC Browser PC Browser icon.

    Purchase Order Request Form

    The Customer Enquiry Request form shows in runtime.


    Advanced tab
  2. On the Customer Enquiry Request form, in the How do you know about us? list, select Other.

    The Other text box shows.


    Advanced tab

    If you select a different value from How do you know about us? list, the Other text box does not show.


    Advanced tab

How to Get the App

This example is based on the Customer Enquiry app from the AgilePoint NX App Store. Use this procedure to get the app.

Prerequisites

Good to Know

  • This procedure is optional. It is provided so you can test the example with an out-of-the-box app.
  • This is part of the Background and Setup procedures, but many users preferred this step to appear after the example, not before it.

Get the App

  1. Click App Store App Store icon.

    App Store
  2. In the CATEGORY section, click Marketing.

    App Store screen
  3. Click the Customer Enquiry app.

    Marketing Apps screen
  4. On the Customer Enquiry screen, click Add.

    Customer Enquiry screen
  5. On the Trust App screen, click Trust it.
  6. Click Return to site.