< Back
Print

Setting conditions

Please note: the following information is optimized for SAWSConnector versions 1.7.x and higher! Version 1.6 also contains the possibility to set conditions but not to the extend versions 1.7.x and higher do, so some of the following options may not be available to you if you work with a version below 1.7.x.

General information

Sometimes it may be neccessary to only synchronize products, objects or information if a certain condition is met. For example, many customers only want to synchronize products that contain an SKU. Other use cases may be that if attribute A is empty for a product, the contents of attribute B should be used. There are many other use cases. The following information offer an overview how conditions can be used in the connector.

Plugin premise

Conditions can be set for any plugin that is available. Conditions can be set by clicking on the gear wheel symbol of the line in your mapping table that you wish to set a condition for.

 

If a condition is set for a line in your mapping table, the gear wheel will appear bright green. If no condition is set (but other settings have been configured for a certain formatting option), the gear wheel will appear dark green:

Setting conditions

After the click on the gear wheel, the condition settings are available. Click on the “plus” icon to add a condition:

 

Condition actions

 

There are several actions available that are carried out once a condition is met. The action is what you need to define first. After clicking on the plus icon, the following actions will be available:

 

Action Description
Ignore entire data map row if…  The entire row of the data map you add this condition to will be ignored if your condition is met. Example:

Ignore all target key entries of the data map if… The target key you set for your data map row will be ignored even if there are multiple occurences of that key. Example:

Skip product/object if… The product or object will be completely ignored if this condition is met. None of the rows in your data map will be considered for a product or object that does not complay with the condition, no data for this product will be synchronized.

 

Use alternative formatting if… If you set this option, the editor will reload and display the additional setting “alternative formatting” which in turn allows you to set another formatting option:

 

Return placeholder value if… This option is designed for more complex conditions. You can define a placeholder in the placeholder map below (see red mark in the screenshot below) and define a condition that allows you to dynamically return that value. For further description, please read further down.

Operators

Once you have selected an action, you need to select an operator:

The operator can be set to either AND or OR if you work with ONE condition only. If you work with several conditions, you need to select the operator that will give you the desired result:

 

If ALL conditions must be met in order to carry out the action you selected, the operator “AND” must be set. If ONE of the conditions must apply but not the others, set the “OR” operator.

Condition groups

The “group” option is where you set the actual condition. You can select between different conditions OR a condition group (the latter is recommended if you work with more complex conditions):

Condition Description
Condition group This setting will make the editor reload and allow you to combine conditions groups (click Screenshot to enlarge!).

Condition for values from channel This setting will allow you to set conditions for each column from your SC::Channel tables, including non-standard attributes you defined in the SC::Channels settings:

Condition for attribute classes This option allows you to set conditions for certain attribute classes:

Enter the option “contain”/”does not contain” and for the “value” select the class you wish your condition to apply for (only a comma-separated list of class IDs will de displayed!).

Condition for values from job (e.g. root node) This option will allow you to set conditions relating to the job you run your data map with. You can select JobID, Name, ExternalKey of the Job, Root Node or Mode:

Set condition for language map This option will allow you to set conditions relating to the language settings in your data map:

You can find the language settings of your data map in the tab “Settings”, section “Language mapping”:

 

Set condition for placeholder values For a more detailed description, please read further down (“Condition for placeholder values”)
Condition for property of the source attribute This option allows you to set a condition relating to properties of the attribute you mapped in the data map row for which you are about to set the condition:

Set condition for unformatted source value This option allows you to set a condition depending on the value a certain attribute has (does not have to be the source attribute of the data map row). Use the “plus” icon to select an attribute:

Set condition for result value This plugin lets you set conditions for the result value of the data map row you are using the condition for. “Result value” refers to the attribute you mapped and the formatting plugin you set. The result of this configuration will be used to compare it to your condition:

Set condition for result value with PHP  This option allows you to set conditions using PHP code. Enter your code in the text area:

“Check value” and “value”

The “check value” options allows you to define if you would like to apply your condition for a firmly set check value that you can define here or if you would like to use whatever value the data map row returns for your attribute.

Set “firmly set check value” if you need to enter your own value (e.g. for all operators that demand an entry, such as “does not contain”, “is less than”, “char length less than”…) and enter the value in the text field below. Example:

This example condition would apply for all values of the attribute ArticleNR that are less than 5 characters long.

 

Set “use result value” if no value must be set (operators “is empty” or “is not empty”) and/or if the result value of the condition can be used as comparison. . Example:

This example condition would apply for all empty values of the attribute ArticleNR.

Working with placeholders in conditions

You can use placeholders in conditions as well. You can use them to dynamically define a value your condition is compared to or you can define them as a return value if your condition is met/not met.

UseCase #1: Using placeholders as comparison value

If the value you need your condition to be compared to is dynamic, you can use placeholders to define that dynamic value.

 

Example configuration:

Use the option “firmly set check value” and enter your placeholder name in brackets in the corresponding “Value” text area. In the placeholder map below, define the placeholder. Please note that in order for this to work the placeholder name and the name of the placeholder in the “Value” text area MUST match (see red arrow above).

In example above, the placeholder is derived from the attribute “EAN code” which we formatted using the “format strings” plugin, for example because we need to skip the first 3 characters from the EAN code and compare that value to our condition.

 

UseCase #2: Using several placeholders as comparison values

Another way to use placeholders (espescially if you need to compare several values) is to use the condition group option “Set condition for placeholder values”

Example configuration (click to enlarge):

In this case the Connector will compare placeholder3 (=firmly set check value) with placeholder1 first and – if that value is empty – compare it with placeholder 2. Placeholder2 will not be used for comparison if placeholder1 contains a value. Again, placeholders must be dedined in the placeholder map and names must match!

 

Please note: the nomenclature {placeholder1|placeholder2} (that is, several placeholders separated by the pipe sign) always means an “OR” connection. The placeholder set first will be used if it has a value, if not, the placeholder following the pipe will be used next. The order in which you indicate placeholders within brackets defines the order in which they will be used for comparison (if used within a condition) or as a return value (if used with the “Return placeholder” action of conditions).

UseCase#3: Returning placeholder values as a result

 

Using conditions and placeholders also allows you to return a placeholder if a certain condition applies.

 

Example configuration:

Set the action “Return placeholder value if…” and apply your condition. Define placeholders and their formatting options and in the text area “return of a placeholder value as defined in the placeholder map”, define the return value using the placeholders.

 

Our example above will return the placeholder values as defined if the text attribute teaser is empty. Placeholder1 will be returned separated by the static ” abc ” and placeholder3 IF placeholder1 has a value. If placeholder1 has NO value, placeholder2 will be returned.

 

Please note: the nomenclature {placeholder1|placeholder2} (that is, several placeholders separated by the pipe sign) always means an “OR” connection. The placeholder set first will be used if it has a value, if not, the placeholder following the pipe will be used next. The order in which you indicate placeholders within brackets defines the order in which they will be used for comparison (if used within a condition) or as a return value (if used with the “Return placeholder” action of conditions).

Was this article helpful?
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Table of Contents