Create a Rule for Tables

Use a collection rule to hide or display columns in a dynamic table, assuming that certain conditions are met at runtime.

To create a collection rule:

  1. Open the page you want to configure and select the table in the Properties pane.
  2. In the Properties pane, click Configure Business Rule to open the Business Rules tab.
  3. In the Business Rules tab, click Create Rule next to Collection Rules to open the Create Business Rule dialog box.

    Rather than starting from scratch, you can duplicate an existing collection rule and use it as the basis for a new rule. To do this, right-click the rule, and then click Duplicate.

  4. Select Regular in the dialog box.
    You can choose If/else or Switch in the dialog box to add conditions to when rules are evaluated. See Add an If/Else Rule and Add a Switch Rule
  5. Enter a label, id, and description for the rule.
    The id is generated automatically based on the label you enter, but you can modify the id if you wish. The description field is not required, but it can be helpful when you later try to understand what a rule is doing, especially when there are many rules.
  6. Click Create

    Your new rule is added to the top of the list of built-in rules under Collection Rules.

  7. Click Edit, and then create a condition for the rule.
  8. In the Fields area, locate the field corresponding to the column you want to configure.

    In a table, each field corresponds to a table column. This means that if a dynamic table is configured to display four fields, the table will have four columns.

  9. Click the dash—or an existing value—for the field's Hidden property, and select a new value for the property in the dropdown list.

    In a collection rule, the only property you can override is the Hidden property. You can set the property to Hidden by Default, Visible by Default, or Always Hidden:

    In a collection rule, you can set the Hidden property for a field even if it's not a table. However, the Hidden property in a collection rule is only applied to table columns. (The property does not affect fields in forms.)

    If you only want to see the fields used in your table, select Show only fields used by layouts. If you don't select this, the list contains all the object's fields. You can select Show only fields with overridden properties to limit the list of fields to those that have been modified by a rule.

To delete a rule, right-click the rule in the list to open the popup menu, and then click Delete.

Rules are evaluated in order, from bottom to top. As you create more rules, make sure you position each one in the order you want them evaluated, using the grab handles (six dots) beside the rules to drag-and-drop them to new positions. You can find out more about how rules are evaluated in Understand What Will Be Shown at Runtime.

If you decide you don’t want to include a rule in the evaluation order, select the rule, then use the Active toggle switch in the upper right corner to deactivate it. (You can also right-click a rule and deactivate and activate it in the popup menu.) This enables you to still keep the rule so you can re-activate it later. You can tell at a glance if a rule is inactive because a little badge appears next to it, like this:



Inactive rules are not included in the rule evaluation process.

Note:

You can deactivate all the rules at once by clicking the three dots next to the Built-in Rules heading, then clicking Deactivate All. This can be useful when debugging a page, allowing you to see the page with no rules applied. Use Activate All to reinstate all the rules at once, or use the Active toggle to selectively activate them as you work through your debugging process.