Jump to content

On Change

From Resco's Wiki
Revision as of 11:22, 18 July 2022 by Marek Rodak (talk | contribs)
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:

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

Forms

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.). To create a rule, open the Rules editor by clicking on the corresponding event button.

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.