Rules
This page covers the following ways to work with rules:
Rules are powerful tools that control logic and help automate functions within a form, such as updating one field automatically when data in another field is changed. Rules can apply formulas to data, change data, and change the appearance of data in a form.
For example, you would use a rule to make a Button trigger a specific function, such as a search against a database, activating a Web service, or setting a field value. You can also use a rule to indicate incorrect data entry by changing a field color to red to indicate an incorrect value.
For Advanced Rules
If the Solution Builder does not provide the flexibility required to create a rule, advanced users can create rules using custom JavaScript. See the JavaScript Reference Guide for information about supported JavaScript wrappers, syntax, and more.
Rule actions
Every rule can consist of one or more Actions. In the example above, a single rule could be used to handle both functions, each of which would be a separate action. For example, you can use a rule to automatically calculate and update the total price form field based upon values entered by the user in an item price field and a quantity field.
When applying more than one rule to a Field or Button, the following Actions can only be used once and must be the last rule in the sequence:
- Execute Query
- Execute Web Service
- Submit Form
This is because a request is made to the server so no additional rules can be executed once the request has been made.
Fields with rules applied to them appear with a check icon next to their name in the Solution pane on the Solution tab. Example:
A rule consists of a rule type (Action, Formatting, or Validation), one or more Conditions, or one or more Actions.
Add a new rule
- In the Properties pane, click Properties.
- On the Properties tab, next to Rules, click the Options [...] button.
- The Rules Inspector opens in the Properties pane.
- Click Add Rule.
- Enter the following information for the rule:
- Label: Type a descriptive name for the rule.
- Run Rule On form Load: Select this to run the rule as soon as the form is loaded.
- Type: Select a Rule Type: Validation, Formatting, or Actions.
- Condition: Click to create the condition(s) for when the rule is triggered, such as when a specific form field changes. See Work with conditions (below) for more information.
- Message: Enter a message to display to the user when the rule is run.
- Use Popup: Check this box to use a popup to display the message to the user.
- Popup Title: If you selected Use Popup, type a name for the popup window in this field.
- Click OK to finish.
Change or delete existing rules
Click in the field or element that has the rule you wish to change.
- In the Properties pane, click Properties.
- On the Properties tab, next to Rules, click the Options [...] button.
- In the Rules Editor:
- Click add to add a rule action.
- Click the edit icon to open the rule in the editor.
- Click the delete (trash can) icon to delete the rule.
- Click the condition to change the rule condition. See Working with conditions (below) for more information.
- Click delete condition (the trashcan) to delete a condition.
- Click OK to finish your changes.
Use the Rules Inspector
Use the Rules Inspector to get a snapshot or 'dashboard' of all the rules in your solution.
From the Rules Inspector, you can:
- Search for specific rules in the search bar to filter results.
- Print the results.
- Edit a rule by clicking its name.
- View all of the rules applied to a field by clicking the name of the field.
Work with conditions
The Condition Builder provides a simple graphical interface for creating the logic and rules for your condition.
- Click Add Condition to add a condition.
- Click Add Group to add a sub-group of conditions.
- Select Form Fields and logical operators (such as "is equal to" or "not equal to" for example) from the drop down menus.
- Click Delete to delete a condition or group.
Below: A sample condition in the Rule Condition Builder
Types of rules
There are 4 basic types of rules: Validation, Formatting, Action, and JavaScript (see the JavaScript reference guide for more information about JavaScript rules.) Each type of rule is also governed by a common set of general properties.
See below for details about the following:
- General rule properties
- Validation rules
- Formatting rules
- Action rules
- Action Rule Quick Reference Table
General rule properties
Run Rule on Form Load Indicates whether or not the rule should be executed immediately when the form is loaded.
Halt Execution in Debugger Before running this rule
This option is good for troubleshooting rules. Enabling this option inserts a debug breakpoint into the javascript code just prior to executing the rule. If the browser Development Tools are active and this rule is executed, the browser debugging session will stop just prior to executing the rule for further interrogation of the code.
Disable Rule
Enabling this option stops the rule from running when the form is run.
Type Specify the type of rule to create. Additional options will be displayed depending on the type of rule selected. See below for more information:
- Validation
- Formatting
- Action
Condition If the specified condition condition is true this rule will be run, otherwise it will not run.
If you use a condition to compare against a Reference Data list Yes/No column:The value must be True or False (without quotation marks, etc.) The first letter must be capitalized, i.e., True or False, not true/false
1. Validation Rules
A Validation Rule can be used to display an error message when data entered into a form field is invalid. You can specify the conditions under which the error message is displayed. For example, you could create a rule to display an error if a number entered into a field is greater than a certain value, less than a certain value, or both.
|
2. Formatting Rules
Formatting rules apply specific formatting to a form field when certain conditions are met. For example, if the value entered into a form field is too high, you can create a rule to change the form field to the color yellow.
|
Font Style Modifications |
Font style modifications (to apply the form component for this field):
|
Form Component Modifications |
To hide, require, or disable a field, create an
Action Rule using Change Field Properties. For more information, see
the entry for Change Field Properties in the Action Rule - Quick
Reference Table.
|
3. Action Rules
Action rules are the most versatile rules. Action rules can perform a wide range of functions, such as setting values in specific fields, comparing values in fields, calculating values based upon formulas, and more.
|
Once you have specified the basic information and conditions for an Action rule:
|
Action rules - quick reference table
See below for a description of what each Action rule does, and the parameters associated with the action.
Action | Description |
---|---|
Add New Row |
Adds a new row to a repeating table or group. Parameters
|
Change Field Properties |
Change a field's properties to show, hide, enable / disable, or require / not require input. Parameters
|
Change Group Display |
Shows, Hides, Expands, or Collapses a group based upon a specified field within the group. Parameters
|
Copy Like Rows |
This rule can be used to copy rows from one repeating table or repeating group to a target repeating table or repeating group. This rule matches the column value in the source repeating element to determine which rows to copy based upon the selector field property. The Copy Rows Action determines if the matching rows should be overwritten or added to the target repeating element as new rows. |
Copy Table Data |
You can copy data between tables using the Copy Table Data rule available in the Solution Builder user interface. If you want to access this feature, please reach out to your Sales account representative for more details. Parameters
Notes and Limitations
|
Delete Row Options |
Parameters
|
Empty Table |
Clears all data out of a repeating table or group. Parameters
|
Execute Query |
Executes a Query control in the form. Parameters
|
Execute Rules for Field |
Runs the rule on another field. This can be useful if 2 fields have rules related to one another. Parameters
|
Execute Web Service |
Executes a web service control in the form. Parameters
|
Filter Repeating Content |
Enables the filtering of Repeating Tables/Groups while preserving the content. You can configure a “condition” to use with this -- for example, field1= “this” and field2 != “that”. Only the rows that satisfy the condition(s) will be displayed in the Repeating Table/Group. Parameters
|
New Row Options |
Parameters
|
Reload Drop Down Options |
Causes the options of a drop down list or Combo box to be reloaded. This may be used for dynamic options lists. Parameters
|
Render Map |
Sends a new address to a map control on the form. Parameters
|
Search Repeating Content |
This provides a mechanism to search all fields for a “pattern” (for example, if any field contains “abcd”). In this case all the rows where at least one field contains the pattern will be displayed in the Repeating Table/Group. Parameters
|
Set a Field Value |
This action allows you to change the value of a field in the form. Parameters
|
Set a Label |
This rule action is similar to Set a Field Value (above), but will change the Label (or sub-Label) of a Form Element. Parameters
|
Show Message |
This displays a pop up box with the message text specified in the rule. The properties on this rule are derived from a form's fields by default. |
Sort Repeating Content |
Sort the items in a repeating table. Parameters
|
Submit Form |
This action allows you to simulate the Submit button of the form. Parameters
|