Logic
Learn about Logic in templates and how to use it
Logic is an experimental feature and may change in the future
Logic is a way to turn your templates into smart templates. Enriching your template with logic allows it to auto-complete other sections based on the input or selection of elements.
Logic can only be set on certain elements:
How logic works
Logic are groups of conditions and actions (logic groups), that when set will auto-complete different sections of your template. Multiple conditions can be set in a logic group, as well as multiple actions.
Once a condition has been met, then action will occur, e.g.:
When Button A is set to X
Set Text Field B to be Y
Example
To add more context to how logic work, lets consider the following example. In your template, you have 2 elements:
A Button that defines a patients smoking statues with the following options:
Non-smoker
Smoker
A Checkbox that contains smoking cessation advice, in your Discussion section
We will create the following logic:
When the button option 'Smoker' is selected, set the checkbox with smoking cessation advice to active

This will result in when a patient has been noted as a smoker, the smoking cessation advice will automatically be added to the output notes.

Adding logic to a Template
To start adding Logic to your Template, you need to enable editing mode.
Once enabled, click on the Logic icon in the Editor tool bar to open the Logic Panel

Start adding in your logics conditions and actions
Adding comments
You can add comments within your logic to give more context to what it does. This is useful for the readability of the logic, remembering why you included certain elements or a further explanation of the logic itself.

Re-ordering Logic
Logic is executed in the order it is displayed in. To re-order your logic groups, simply drag the 6 dot icon.

Other features
The logic panel can be expanded or collapsed to view more of your logic

Templates that have Logic set, will have the Logic icon displayed in the top bar.

You can click on it to open the Logic panel and view the Template logic.
Conditions and Actions
Conditions
Conditions set the bases for your logic. When the Condition for a logic group is met, the Action will be executed.
Condition types
Is
All
If the elements value matches this, the condition is met.
It can be left empty to define being blank, or un-selected
Is not
All
If the elements value IS NOT this value, the condition is met.
It can be left empty to define being blank or unselect.
contains
All
If the elements value CONTAINS this value, the condition is met.
This value cannot be left empty.
Is populated and active
All
If the element is populated and active (i.e on an active line), the condition is met.
If this condition is set, you can use the Set to condition value action, see here for more information.
Has state
To define the checked state of the checkbox for the condition to be met:
E.g, checked or unchecked.
Has selected
Allows you to specify what options in the element and their state to have the condition met.
Using 'Has Selected'
When using the 'Has Selected' condition, you can define all or certain options within the element to form the logic. This is useful for handling context specific log.
You can also set each selected options state to make the condition value, e.g. if the option is selected or unselected.

Setting the Combination value can allow you to further refine your condition. This can be set to either ANY or EXACT:
ANY - means that ANY of the options being selected will trigger meet the condition
EXACT - means that the EXACT combination needs to be selected to meet the condition.
Tooth selector conditions
When setting the conditions for a Tooth Selector, you must choose the options in its menu that will meet the condition
Chaining Conditions
Conditions can be chained to add multiple conditions as part of your logic group. When chaining conditions, you can define ‘AND’ or ‘OR’
AND - means that condition 1 AND condition 2 etc need to be met for the condition to be valid
OR - means that at least 1 of the conditions defined need to be met for the condition to be active.

Actions
Actions define what should actually happen when a logic condition has been met. Some action types are element specific.
You can also set multiple actions to occur as part of the logic group, similar to condition chaining.
Action Types
Set text
All
Defines to set the Action elements text value to the defined value.
It can be left empty to define being blank, or un-selected
Set to conditions value
All
Defines to set the Action elements value to the same value of the condition element.
This can only be set if the condition type was 'Is populated and active'
Cannot be used with chained conditions
Set selected
Defines the Action elements options to set, as part of the action.
Using 'Set Selected'
When using the 'Set Selected' action, you can define which options in the element you want to be set.
You can also set what each options state should be e.g. selected or unselected.
Setting the Behaviour value will allow you to override existing options set on the element or preserve already set options. This can be set to either SET or INCLUDE:
SET - means to SET the elements options to the combination defined, removing any already set values
INCLUDE - means it will add (INCLUDE) these defined combination, keeping any already set values unchanged.
Actions on Tooth Selectors
When setting an action on a Tooth Selector, you will be required to select the elements options to set in its menu.
Last updated