Example of using a table component on an order form

The following example shows the table component and rules functionality.

XYZ Corporation uses a request for creating and tracking employee computer hardware equipment orders. XYZ has included a table component field on their request type for gathering the order information. When the employee selects a product, the unit price is automatically updated. Then, when they update the quantity, the total line cost is automatically calculated and displayed in the table.

To enable this functionality, XYZ needs to configure the following:

  1. Configure a new validation with the following specifications:

    Table 5-6. Example, table component validation settings

    Setting

    Value / Description

    Validation Name

    Product Order Information

    Component Type

    Table Component

    Column 1

    • Column Header = Products
    • Column Token = PRODUCTS
    • Validation = Auto-complete with the following list values: PC, MOUSE, MONITOR, KEYBOARD

    Column 2

    • Column Header = Quantity
    • Column Token = QUANTITY
    • Validation = Numeric Text Field

    Column 3

    • Column Header = Price
    • Column Token = PRICE
    • Validation = Numeric Text Field

    Column 4

    • Column Header = Total
    • Column Token = TOTAL
    • Validation = Numeric Text Field
  2. Use the Rules tab to set the default unit price based on the product selected.

    Table 5-7. Example, Set Unit Price rule settings

    Setting

    Value / Description

    Rule Name

    Set Unit Price

    Rule Event

    Apply on Field Change

    Dependencies

    Column = Products

    All Values = Yes

    Results

    Column Header = Price

    SQL

    SELECT DECODE('[TE.P.PRODUCTS]', 'PC', 1200,

    'Mouse', 50,

    'Monitor', 560,

    'Keyboard', 110, 0),

    DECODE('[TE.P.PRODUCTS]', 'PC', 1200,

    'Mouse', 50,

    'Monitor', 560,

    'Keyboard', 110, 0)

    FROM sys.dual

  3. Add another rule to calculate and display the total line price in the Total column based on the values in the Products and Quantity fields.

    Table 5-8. Example, Calculate total rule settings

    Setting

    Value / Description

    Rule Name

    Calculate Total

    Rule Event

    Apply on Field Change

    Dependencies

    Column = Price [All Values = Yes]

    Column = Quantity [All Values = Yes]

    Results

    Column Header = Total

    SQL

    SELECT [TE.P.PRICE] * [TE.P.QUANTITY], [TE.P.PRICE] * [TE.P.QUANTITY]

    from sys.dual