Each condition in the condition table will be processed individually and each one will result in a value. Those outcomes from multiple conditions are then put together seperated by | to form a single value that than can be mapped in a value mapping table to get the final result. This will be put in the datamodel field that was selected creating the manipulation block.
The nature of this feature is to be completely free in creating combinations of conditions on any datamodel field. This however also results in an unlimited amount of possibilities and combinations to form a conditional block. This guide will therefor not go over all possible combinations but will explain each condition and action available hoping this will show what can be done and how to achieve that when combining actions and conditions explained. Together with some real life examples this should be enough guidance to start using this feature.
The Business rules tab
When you go to the flow details of an integration a new tab will be visible next to settings called business rules. On top of this tab there is a button called Add new. After clicking two new fields will become available to select a field from the datamodel to which the rule block will apply and a field to enter an optional name for the block that will be used instead of the datamodel field when there is a value entered.
When at least the datamodel field has been selected the button to save this info becomes available which will generate a new rule block after saving the information to the database. The block looks exactly how the default settings already looked with a switch to turn on and off the default usage and when enabled more options become available like the value and if it is supposed to be forced or not. Just like with the default settings there is an option available to use a mapping table that again will unlock a setting about what to do when a value cannot be mapped when it is enabled.
New to this block is the conditional table that will allow creation of the conditions when enabled. When the table is enabled the first conditional block is shown and the first row is available offering the following fields:
- row condition: (optional) a dropdown for selecting AND, OR or `` as the condition to apply to the row allowing more complex conditions
- start: (optional) a dropdown for selecting if the row should start with a ( to group rows of conditions or not.
- datamodel field: (required) a dropdown in which a datamodel field can be selected on which the condition has to be applied
- condition: (required) a dropdown that allows selecting one of the currently supported conditions
- value: (optional) an input-box where a value can be specified to either check on or that should be used when condition is met.
- action: (required) a dropdown in which an action can be specified that should be applied to the value
- end: (optional) a dropdown for selecting if the row should end with a ) to end the group of rows.
Data model field
The first thing that needs to be selected when creating a condition is the datamodel field. This is NOT by definition the datamodel field that was selected when creating the manipulation block. Instead every field in the datamodel can be selected to apply the condition to.
In other words: When you want to check if the customer is from a certain country to add a certain price increase the business rule block will have to be made on the desired unitPrice.amount.inclTax field while the condition row itself will have the customer.country.code field selected as the datamodel field as this is the actual field the condition should be based upon.
Conditions
Condition |
Definition |
Not empty (default) |
checks is the datamodel field is not empty (holds an actual value) |
Empty |
checks is the datamodel field is empty (holds no actual value and is not false or 0) |
Equal |
value from the datamodel field equals the value specified in the value field |
Not equal |
value from the datamodel field does not equal the value specified in the value field |
Greater |
value from the datamodel field is greater than the value specified in the value field |
Greater or equal |
value from the datamodel field is greater than or equal to the value specified in the value field |
Less |
value from the datamodel field is less than the value specified in the value field |
Less or equal |
value from the datamodel field is less than or equal to the value specified in the value field |
Contains |
value from the datamodel field contains the value from the input-box |
Not Contains |
value from the datamodel field does not contain the value from the input-box |
Is true |
value from the datamodel field is true |
Is false |
value from the datamodel field is false |
Starts with
|
value from the datamodel starts with
|
Not starts with
|
value from the datamodel doesn't start with
|
Ends with
|
value from the datamodel Ends with
|
Not ends with
|
value from the datamodel doesn't end with
|
Conditions are basically the checks that should be applied to the datamodelfield or the value in it. Currently the following conditions are supported:
The outcome of a condition is always TRUE or FALSE what happens as a result is determined by the action
Actions
An action defines what should be done in case the condition is met and determines what the final value will be that will be used in the end-result of the conditional block.
The following list of actions is currently supported and will be executed when the result of the condition was TRUE:
Condition |
Definition |
Use result value (default) |
select this option when TRUE or FALSE is the desired outcome |
Use field value |
use the value from the datamodel field as the result |
Use input value |
use the value from the value input box as the result |
Use default value |
use the value from the default value input box as the result |
Multiply with input value |
Multiplies the value from the datamodel field with the value in the value input box |
Divide by input value |
Divides the value from the datamodel field by the value in the value input box |
Add input value |
Add the value in the value input box to the value from the datamodel field |
Subtract input value |
Subtract the value in the value input box to the value from the datamodel field |
Remove all occurances input value
|
Removes all occurences of the value in the field
|
Remove first occurance input value
|
Removes the first occurence of the value in the field
|
Remove last occurance input value
|
Removes the last occurence of the value in the field
|
Add input value to start
|
Add the input to the field at the start of the field
|
Add input value to end
|
Add the input to the field at the end of the field
|
Remove array element
|
Removes the array element from the data set
|
Remove datamodel field value
|
Empty the field field value
|
The final result of the all the actions for all row is glued together seperated by ‘|’. Eg. NL|TRUE|01 which can than be mapped using the mapping table, see example below
Using row conditions & brackets
By default each condition is treated individually and each of the results is glued together to become the actual result of the conditional block. However in case more complex conditions are desired like cases where 2 fields need to meet a condition at the same time before being considered to be true this requires to group the conditions together which can be done using brackets and row conditions.
All conditions that are between a starting ( and a closing ) will be considered to be a group of conditions that will evaluate to a single result value (TRUE or FALSE). To specify if both conditions should be true the row condition AND should be selected on the second condition of the group. In case only one of the conditions needs to be true OR should be selected instead. When no row condition is specified but brackets are used to group conditions the row condition AND will be used in case the datamodel fields for the conditions are different and OR will be used in all cases where the datamodel fields if the conditions are the same. This will automatically be stored in the database when saving the manipulation block.
Be aware that mixing the 2 row conditions within the same group of conditions may cause unexpected results and is discouraged. In cases where either one of 2 should be true while a 3rd has to be true this should be grouped correctly using the brackets and row conditions
If no brackets are specified but any of the condition rows has a row-conditions specified, it will be ignored