On Change: Difference between revisions
Marek Rodak (talk | contribs) |
Marek Rodak (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
{{Rules TOC}} {{WIP}} | {{Rules TOC}} {{WIP}} | ||
The '''On Change rules''' are checked when any field is modified. Rules are client-side scripts that are executed when a user of the mobile app interacts with the app. Rules are no-code [[business logic]], which are managed using the [[rules editor]], usually in [[Woodford]]. | The '''On Change rules''' are checked when any field is modified. Rules are client-side scripts that are executed when a user of the mobile app interacts with the app. Rules are no-code [[business logic]], which are managed using the [[rules editor]], usually in [[Woodford]]. | ||
Revision as of 11:56, 19 July 2022
| Rules and examples |
|---|
|
| Warning | Work in progress! We are in the process of updating the information on this page. Subject to change. |
The On Change rules are checked when any field is modified. Rules are client-side scripts that are executed when a user of the mobile app interacts with the app. Rules are no-code business logic, which are managed using the rules editor, usually in Woodford.
On Change rules are available for the following user interface components:
- Forms
- Editable views
- Questionnaires
- Schedule Board
IsLoaded
IsLoaded is a variable, property which checks whether the form or questionnaire is fully loaded and visible on the screen, with all the values assigned. For example, you can use it to differentiate between the initial loading of a form and manual user change.
| IsLoaded | Equals | True |
ChangedItem
This is often used in conditions to determine which item was changed. In Cell Click and Button Click rules, this is the name of the clicked item. In On Change events, it is a variable that can be assigned the changed entity field.
| ChangedItem | Assign | address1_city |
Forms
Form rules describe sequences of steps that are executed on form-related events. On change rule on form usually serves as a simple field validation.
- Rule execution
- When you modify any field.
- When form is loaded (a new form starts empty, then the values are changed as they are loaded from the database and displayed).
- When an associated/related record is created or modified - it has to be set up in the properties of an associated list. Open Properties of associated list and in Properties section check Trigger OnChange event option.
- Setting a value inside the On Change rule for a field placed on the form triggers the On Change rule again.
Example: Postal code validation
When a user enters information into a field, you may want to verify that the format is correct. In the rule below, we verify that the postal code field matches the expected format.
Views
On Change rules can be used with views, but only when the Editable field is set. (Editable field, list, or editable grid is a feature that allows users to edit one or more records directly from the view, without a need to go to the form of a record.)
- Rule execution
- When you modify any field.
- When a view is loaded (a new form starts empty, then the values are changed as they are loaded from the database and displayed).
Questionnaires
Editing rules allow you to further customize the questionnaire form’s design and usage (hide or disable form fields, assign values to them, etc.).
- Rule execution
- When any value in the questionnaire is modified
- When the questionnaire is first displayed
- When a repeatable group is repeated
- When a repeatable group is deleted
Example: Additional questions
When a user answers a question in a certain way, you may want to display additional questions. For example, if the answer to the question “Are you married?” is “Yes”, an additional question “Partner's name” is set to be visible.
Example: Automated date of next inspection
When a user answers a question in a certain way, you might want to change the other questions. For example, you can count the next inspection date based on the periodicity of inspections.