On Create: Difference between revisions
Marek Rodak (talk | contribs) |
No edit summary |
||
| Line 1: | Line 1: | ||
{{Rules TOC}} {{WIP}} | {{Rules TOC}} {{WIP}} | ||
The '''On Create rules''' are executed before a questionnaire or report instance is created. Rules are no-code [[business logic]], which are managed using the [[rules editor | The '''On Create rules''' are executed before a questionnaire or report instance is created. Rules are no-code [[business logic]], which are managed using the [[rules editor]]. | ||
On Create rules are available for the following | On Create rules are available for the following components: | ||
*[[Questionnaire Designer|Questionnaires]] | * [[Questionnaire Designer|Questionnaires]] | ||
*[[Report Designer]] | * [[Report Designer]] | ||
*[[Schedule Board | * [[Schedule Board]] | ||
== Questionnaires == | == Questionnaires == | ||
On Create [[Questionnaire_Designer#Editing_rules|rules in questionnaires]] can be used to define additional variables which can be used in the reuse fetch. This can ensure that inspectors can select from a relevant list of answered questionnaires. | |||
{{Note|Requires version 3 (or later) of rules and version 15.0 (or later) of the mobile app.}} | {{Note|Requires version 3 (or later) of rules and version 15.0 (or later) of the mobile app.}} | ||
;Rule execution: | ;Rule execution: | ||
*When a questionnaire instance is about to be created. | * When a questionnaire instance is about to be created. This happens even before the [[On Load]] event. | ||
== Report Designer == | == Report Designer == | ||
Report Designer also supports rules that can add some business logic to your reports. In the case of the Report Designer, whenever a new report is created, or a new instance of a repeating block is created, an On Create event is triggered. | Report Designer also supports rules that can add some business logic to your reports. In the case of the Report Designer, whenever a new report is created, or a new instance of a repeating block is created, an On Create event is triggered. | ||
{{Note|For reports, the steps don't allow you to control the user interface (enable or disable a field, show or hide something, etc.); you can only assign values to variables or perform arithmetic operations.}} | {{Note|For reports, the steps don't allow you to control the user interface (enable or disable a field, show or hide something, etc.); you can only assign values to variables or perform arithmetic operations.}} | ||
| Line 26: | Line 31: | ||
;Rule execution: | ;Rule execution: | ||
*When a new report is created. | *When a new report is created. | ||
*When instance of a repeating block is created. | *When an instance of a repeating block is created. | ||
=== Example: Multiply values === | |||
There are situations where you don't want to display two fields directly, but you want to perform an arithmetic operation and display the result. See [[Report_Designer_examples#Multiply_values|Multiply values]]. | |||
=== | == Schedule Board == | ||
You can configure business logic in the toolbar. Schedule Board supports two types of rules, On Create is one of them. The On Create rule triggers when a new activity (task) entity is created based on the source entity. | |||
You can configure business logic in the toolbar. Schedule Board supports two types of rules, On Create is one of them. The On Create rule triggers when a new activity (task) entity is created based on the source entity | |||
;Rule execution: | ;Rule execution: | ||
*When the source entity item is dragged from the list of source entities onto the timetable. | * When the source entity item is dragged from the list of source entities onto the timetable. | ||
Revision as of 12:27, 5 August 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 Create rules are executed before a questionnaire or report instance is created. Rules are no-code business logic, which are managed using the rules editor.
On Create rules are available for the following components:
Questionnaires
On Create rules in questionnaires can be used to define additional variables which can be used in the reuse fetch. This can ensure that inspectors can select from a relevant list of answered questionnaires.
| Note | Requires version 3 (or later) of rules and version 15.0 (or later) of the mobile app. |
- Rule execution
- When a questionnaire instance is about to be created. This happens even before the On Load event.
Report Designer
Report Designer also supports rules that can add some business logic to your reports. In the case of the Report Designer, whenever a new report is created, or a new instance of a repeating block is created, an On Create event is triggered.
| Note | For reports, the steps don't allow you to control the user interface (enable or disable a field, show or hide something, etc.); you can only assign values to variables or perform arithmetic operations. |
To define the steps, proceed as follows:
- Select either the report body or a repeater.
- Click Edit Sources to display a list of variables defined for that component.
- Select any variable and click On Create to display the rules editor.
- Use the usual Rules editor syntax to define one or more steps that should be performed.
- Remember to save all changes.
- Rule execution
- When a new report is created.
- When an instance of a repeating block is created.
Example: Multiply values
There are situations where you don't want to display two fields directly, but you want to perform an arithmetic operation and display the result. See Multiply values.
Schedule Board
You can configure business logic in the toolbar. Schedule Board supports two types of rules, On Create is one of them. The On Create rule triggers when a new activity (task) entity is created based on the source entity.
- Rule execution
- When the source entity item is dragged from the list of source entities onto the timetable.