This screen stipulates the if conditions of the Rules, in other words when the Rule will execute. Select the Simple Comparison, Validation or Custom Condition required to display the Rule Definition on the canvas. Items that are in green are configured, items that are in green with a dotted line still need to be configured, and items in grey cannot be configured until something else has been set. Configure the rule by replacing the green with the relevant setting.The conditions available are described in the below table:
Type | Template | Used For |
---|---|---|
Simple Comparisons | A control contains a value | Ensuring a field is not blank |
Simple Comparisons | A control contains a specific value | Firing a rule only when a specific field has a specific value |
Simple Comparisons | A control does not contain a value | Firing a rule when a field is blank |
Simple Comparisons | A control does not contain a specific value | Firing a rule if a field is not a specific value, such as when Region does not equal USA, then Load Territories |
Simple Comparisons | A control on a View contains a value | Ensuring a field is not blank on a View |
Simple Comparisons | A control on a View does not contain a value | Firing a rule when a field is blank on a View |
Simple Comparisons | A control on a View contains a specific value | Ensuring a field contains a specific value on a View |
Simple Comparisons | A control on a View does not contain a specific value | Firing a rule when a field is not a specific value on a View |
Simple Comparisons | A control on a subview contains a value | Ensuring a field is not blank on a subview |
Simple Comparisons | A control on a subview does not contain a value | Firing a rule when a field is blank on a subview |
Simple Comparisons | A control on a subview contains a specific value | Firing a rule only when a specific field has a specific value on a subview |
Simple Comparisons | A control on a subview does not contain a specific value | Firing a rule if a field on a subview is not a specific value, such as when Region does not equal USA, then Load Territories |
Simple Comparisons | A control on a View on a subform contains a value | Ensuring a field is not blank on a View on a subform |
Simple Comparisons | A control on a View on a subform does not contain a value | Firing a rule when a field is blank on a View on a subform |
Simple Comparisons | A control on a View on a subform contains a specific value | Firing a rule only when a specific field has a specific value on a View on a subform |
Simple Comparisons | A control on a View on a subform does not contain a specific value | Firing a rule if a field on a View on a subform is not a specific value, such as when Region does not equal USA, then Load Territories |
Simple Comparisons | A control on a subform contains a value | Ensuring a field is not blank on a subform |
Simple Comparisons | A control on a subform does not contain a value | Firing a rule when a field is blank on a subform |
Simple Comparisons | A control on a subform contains a specific value | Firing a rule only when a specific field has a specific value on a subform |
Simple Comparisons | A control on a subform does not contain a specific value | Firing a rule if a field on a subform is not a specific value, such as when Region does not equal USA, then Load Territories |
Simple Comparisons | A control on this Form contains a value | Ensuring a field is not blank on the current Form |
Simple Comparisons | A control on this Form does not contain a value | Firing a rule when a field is blank on the current Form |
Simple Comparisons | A control on this Form contains a specific value | Firing a rule only when a specific field has a specific value on the current Form |
Simple Comparisons | A control on this Form does not contain a specific value | Firing a rule if a field on the current Form is not a specific value, such as when Region does not equal USA, then Load Territories |
Parameter Conditions | A Form parameter has been specified |
Ensuring a parameter on the Form is not blank |
Parameter Conditions | A Form parameter has not been specified |
Firing a rule when a parameter on the Form is blank |
Parameter Conditions | A Form parameter has a specific value |
Firing a rule only when a parameter has a specific value on a Form |
Parameter Conditions | A Form parameter does not have a specific value |
Firing a rule if a parameter on a Form is not a specific value |
Parameter Conditions | A subform parameter has been specified |
Ensuring a parameter on the subform is not blank |
Parameter Conditions | A subform parameter has not been specified |
Firing a rule when a parameter on the subform is blank |
Parameter Conditions | A subform parameter has a specific value |
Firing a rule only when a parameter has a specific value on a subform |
Parameter Conditions | A subform parameter does not have a specific value |
Firing a rule if a parameter on a subform is not a specific value |
Parameter Conditions | A subview parameter has been specified |
Ensuring a parameter on the subview is not blank |
Parameter Conditions | A subview parameter has not been specified |
Firing a rule when a parameter on the subview is blank |
Parameter Conditions | A subview parameter has a specific value |
Firing a rule only when a parameter has a specific value on a subview |
Parameter Conditions | A subview parameter does not have a specific value |
Firing a rule if a parameter on a subview is not a specific value |
Parameter Conditions | A View parameter has been specified |
Ensuring a parameter on the View is not blank |
Parameter Conditions | A View parameter has not been specified |
Firing a rule when a parameter on the View is blank |
Parameter Conditions | A View parameter has a specific value |
Firing a rule only when a parameter has a specific value on a View |
Parameter Conditions | A View parameter does not have a specific value |
Firing a rule if a parameter on a View is not a specific value |
Parameter Conditions | A View parameter on a subform has not been specified |
Firing a rule when a View parameter on the subform is blank |
Parameter Conditions | A View parameter on a subform has been specified |
Ensuring a View parameter on the subform is not blank |
Parameter Conditions | A View parameter on a subform has a specific value |
Firing a rule only when a View parameter has a specific value on a subform |
Parameter Conditions | A View parameter on a subform does not have a specific value |
Firing a rule if a View parameter on a subform is not a specific value |
Validation Condition | The Form passes validation | To ensure that all controls pass validation before calling a method such as create or save. |
Custom Conditions | An advanced condition is true |
Advanced conditions using SmartForms data and comparison operators such as:
|
Logical Conditions | Else |
Use in conjunction with Custom/Advanced Conditions |
Error Handling | Error occurred |
See the Error handling topic for more details |
Workflow Condition | a Workflow activity is specified |
Ensuring a workflow activity is not blank |
For-Each Looping | For each item in a List View |
Execute a block of actions for each item in a List View that meets a specified condition. |
For-Each Looping | For each item in a subview |
Execute a block of actions for each item in a subview that meets a specified condition. |
For-Each Looping | For each item in a List View on a subform |
Execute a block of actions for each item in a List View on a subform that meets a specified condition. |
For-Each Looping | For each item in a list control on a View |
Execute a block of actions for each item in a list control on a View that meets a specified condition. |
For-Each Looping | For each item in a list control on a subview |
Execute a block of actions for each item in a list control on a subview that meets a specified condition. |
For-Each Looping | For each item in a list control on a View in a subform |
Execute a block of actions for each item in a list control on a View in a subform that meets a specified condition. |
Mode | If the View is in a certain mode |
Firing a rule if a View is in a certain mode. Mode could be normal or offline. |
Mode | If a View on the Form is in a certain mode |
Firing a rule if a View on the Form is in a certain mode. Mode could be normal or offline. |
Mode | If the Form is in a certain mode |
Firing a rule if a Form is in a certain mode. Mode could be normal or offline. |
Mode | If the subview is in a certain mode |
Firing a rule if a subview is in a certain mode. Mode could be normal or offline. |
Mode | If the subform is in a certain mode |
Firing a rule if a subform is in a certain mode. Mode could be normal or offline. |
Mode | If the View on a subform is in a certain mode |
Firing a rule if a View on a subform is in a certain mode. Mode could be normal or offline. |
When using the Condition An advanced condition is true, a dialog opens where Advanced Conditions can be configured. The same principles are applied here as in the Expression Builder. SmartForms data can be used together with comparison operators such as:
Brackets can be added by clicking on the white spaces between each condition to group conditions as shown below.
If no brackets are applied, OR and AND operators have the same precedence. By applying brackets, the order of execution can be specified.
The following is an example of an Expression tree:
which evaluates to the following:
(((1 OR 2) AND 2) AND 4)
In this example, the OR will execute first and then the two AND operators.
Click here for more information on Parameter rules
The option to disable validation on hidden, disabled or read-only controls, Views and tabs exists. The option is selected by default for all new controls, Views and tabs created that are hidden, disabled or read-only. Controls, Views and tabs that were hidden, disabled or read-only in versions prior to K2 smartforms 1.0.2, will be deselected and the option will have to be checked manually should validation not be performed on these.
Controls, Views and tabs can be validated by using the if the View/Form passes validation condition in the Rule Designer.
Clicking on configure next to the condition will open the validation screen. The option can be selected to disable the validation on hidden, disabled or read-only controls, Views and tabs. This will result in all other controls selected to be validated except the hidden, disabled and read-only controls, Views and tabs.
Required - Requires a value for the validation to succeed. A required control will automatically be validated against the data type of the control.
Validate - Validates the value of the control against the data type of the control, for example does a control of type Number contain a valid number.
Do not validate, hidden, disabled and read-only controls, Views or tabs - All controls belonging to these categories will be ignored when validation is performed, i.e. no validation will be done.
When using a Form with Views, the controls on those can also be selected to be disabled for validation.
Views and tabs can be configured to be hidden and disabled by using Actions in the Rule Designer or the Views can be hidden or disabled by changing the Properties of the View in the Form Designer.
The option to not validate hidden, disabled or read-only controls, Views and tabs will also be applied to controls and Views that are dynamically changed to disabled or read-only in runtime. For example if a control is enabled and is subsequently changed in runtime to be disabled, this option will be applied to that control if the validation is done after the control is changed to disabled.
The For-each Looping conditions below are available for use on List Views and list controls. These conditions can be used together with other If conditions or on its own. The conditions allow the user to perform actions for all items that meet a specified condition.
Permutations:To only save new rows created, use the Added permutation. So only rows that were added to the list will be evaluated and actioned.
The same principle applies when using the For-Each Looping conditions on a list control. It is however advised to think logically about a list control before selecting the permutation, for example it won't make visual sense to use the Checked permutation on a Picker control, even though the functionality would work.
The Mode conditions allow the user to build rules around Views and Forms for when they are defined as Offline. K2 Mobile makes use of the behavior associated with the mode parameter set to Offline, and so can be used as the front-end for Forms. All other platforms will execute within Normal mode.
One example is where the device is offline when opening the Form in K2 Mobile, a message can be sent to inform the user of the offline status.
Permutations:
Normal - Forms and Views have full functionality and require a connection to the server.
Offline - Forms and Views have limited functionality and work without a connection to the server.
Advanced conditions can also be created to check the mode status before executing an action by dragging the Mode from the System Values of the Context Browser.
Video | Links | Learn | Support |
No videos found for this article K2 on YouTube
No Additional links found for this article
No self-learning content for this article Try some scenarios...
No relevant support links available for this article
|