You can control your synchronisation precisely using conditions. Conditions determine whether a data set is synchronised at all (both for create and update). You can configure conditions in a number of ways with different field types and nested structures. This way you can easily realise complex synchronisation conditions.
To set conditions in your plan, navigate to the Connection tab. If you use a bidirectional plan, select the corresponding synchronisation direction. You will see the mapped fields and below them is the configuration area for the conditions, directly below the actions.
To add a condition, click on the Add Rule button.
For each term (left and right side) the following fields then pop up (see picture below): Type, Value.
For Type you can select the following field types:
- Input Field
- Output Field
- Field after action
It is best to always select Field in the left side.
Here you decide whether you want to select a field in the system from which you synchronise (Input Field) or into which you synchronise (Output Field).
If you want to access values that are only available after mapping the field options, select Field after action.
For all three options you get a easy to use field selector to choose the corect field for the selected system.
Otherwise you enter the value of the selected type in the input field. Between the terms you can select the logical operation. The screenshot shows the operation Equals. More options for logical operations:
- not equals
- less than
- greater than
- begins with
- contains not
The options for Type mean the following:
- String: Here you can set conditions based on text.
- Null: Is the value when a database field is empty, i.e. contains nothing, regardless of the data type.
- Boolean: Is the data type for the values true/false.
- Integer: Here you can set conditions based on integers.
In our example below, this means that the field sync must have the value 1 in the system we are synchronising from in order for the record to be synchronised at all.
Of course, you can also combine and chain several conditions. To do so, simply click on the Add Rule button again.
We have extended the condition so that the field external_id must be not equal to “null“. The two conditions are linked with a logical AND (logical operators). This means that both conditions must be true for synchronisation to be executed.
Now we want to realise a more complex condition. To do this, we delete the second condition, as we nest it with another one. We now model a nested condition. Nested conditions are also often represented with brackets. To add brackets, we click on the button Add Group.
We want to model the following synchronisation condition (in different notations):
(deleted == 0) & (external_id == null | external_id == 0)
(deleted == 0) AND (external_id == null OR external_id == 0)
deleted is equal to zero and either external_id is null or is equal to zero
The first group contains the condition of the sync field and the second group contains the two conditions, each with the external_id field. The logical or refers to within the second group. The logical and refers to between both groups.
Both the first term (first bracket) and the second term (second bracket) must apply.
With the arrow next to the AND/OR its possibile to show more common logical operators.
Its possible to add notes to complexe conditions by clicking the description field.
If you need help or advice setting up your conditions, just contact us. We will be happy to help you!