Rules engine / Import rules
Import rules of the rules engine.
Task name:
Examples
json
{
"name": "rules-engine-import-rules",
"taskReferenceName": "c",
"description": "The business description of the task",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"request": "${previousTask.output.file}"
}
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Definition
Property | Type | Required | Description |
---|---|---|---|
The name (or type) of the task | |||
The unique name of the task in your job. It is used to reference this task in the workflow. | |||
The functional description of this task in your job. | |||
The type of the task. It must be SUB_WORKFLOW . | |||
true : the job continues if there is an error on this task. false : the job fails. | |||
Input parameters of the task. See below |
Inputs Parameters
Property | Type | Required | Description |
---|---|---|---|
See below. | |||
The account key of the partner owning the shared table. |
Input - request
Examples
xml
<Rules-Engine table="shared_table" account="f4784206-9584-42a8-b36b-7f263d9af96a">
<Source-Tables>
<Table key="my_table_1" source-identifier="gencod" target-identifier="ean13" />
<Table key="my_table_2" source-identifier="gencod" target-identifier="ean13" />
<Table key="my_table_3" source-identifier="gencod" target-identifier="ean13" />
<Table key="my_table_3" source-identifier="ean" target-identifier="ean13" />
</Source-Tables>
<Rules>
<Identifier key="sku" source-table="my_table_1">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition target="sku" operator="EMPTY" />
<Condition source="articleNumber" operator="NOT_EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_TEXT">
<Copy source="color" use="title" lang="fra" remove-carriage-returns="true" trim-spaces="true" />
</Action>
</Rule>
</Identifier>
<Classification key="typology" source-table="my_table_1">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition target="typology" operator="EMPTY" />
<Condition source="erp" operator="NOT_EMPTY" />
<Condition source="erp" operator="IN">
<Value>laveVaisselle</Value>
<Value>frigo</Value>
<Value>réfrigérateur</Value>
</Condition>
</Condition-Group>
</Conditions>
<Action type="SET_CATEGORY">
<HashMap source="erp">
<Entry source="laveVaisselle" target="dishwasher"/>
<Entry source="frigo" target="fridge"/>
<Entry source="réfrigérateur" target="fridge"/>
</HashMap>
</Action>
</Rule>
<Rule priority="2" name="Perceuse si type est sans fil">
<Conditions>
<Condition-Group>
<Condition source="erp" operator="EQUALS">
<Value>Perceuse</Value>
</Condition>
<Condition source="type" operator="EQUALS">
<Value>sansFil</Value>
</Condition>
<Condition target="typology" operator="EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_CATEGORY">
<Value>cordlessDrill</Value>
</Action>
</Rule>
<Rule priority="3" name="Perceuse si type est avec fil">
<Conditions>
<Condition-Group>
<Condition source="erp" operator="EQUALS">
<Value>Perceuse</Value>
</Condition>
<Condition source="type" operator="EQUALS">
<Value>avecFil</Value>
</Condition>
<Condition target="typology" operator="EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_CATEGORY">
<Value>wiredDrill</Value>
</Action>
</Rule>
</Classification>
<Field key="titleEn" source-table="my_table_1">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition target="titleEn" operator="EMPTY" />
<Condition target="label" operator="NOT_EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_TEXT">
<Copy target="label" remove-html="true" remove-carriage-returns="true" trim-spaces="true" />
<!-- If label is a single_select extract parameter is required, if we extract title lang is required -->
<!-- <Copy-Text-From target="label" extract="title">cordlessDrill</Copy-Text-From> -->
<!-- <Copy-Text-From extract="title" lang="fra">cordlessDrill</Copy-Text-From> -->
</Action>
</Rule>
</Field>
<Field key="descriptionEn" source-table="my_table_3">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition target="descriptionEn" operator="EMPTY" />
<Condition target="label" operator="NOT_EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_TEXT">
<Copy target="label" remove-html="true" remove-carriage-returns="true" trim-spaces="true" />
</Action>
</Rule>
<Rule priority="2">
<Conditions>
<Condition-Group>
<Condition target="descriptionEn" operator="EMPTY" />
<Condition target="descriptionEn" operator="EQUALS">
<Value>specific value</Value>
</Condition>
</Condition-Group>
</Conditions>
<Action type="SET_TEXT">
<Value>Default</Value>
</Action>
</Rule>
</Field>
<Field key="brand">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition target="brand" operator="EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_OPTION">
<Value>eberhardt</Value>
</Action>
</Rule>
</Field>
<Field key="description" source-table="my_table_1">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition target="description" operator="EMPTY" />
<Condition source="composition" operator="NOT_EMPTY" />
<Condition source="matière" operator="NOT_EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_TEXT">
<Template trim-spaces="true">
<![CDATA[
<b>Composition</b>
<br></br>
{{source("composition")}}
<br></br>
<br></br>
<b>Matières</b>
<br></br>
{{source("matière")}}
]]>
</Template>
</Action>
</Rule>
</Field>
<Field key="face" source-table="my_table_1">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition target="face" operator="EMPTY" />
<Condition source="vueDeFace" operator="NOT_EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_IMAGE">
<Copy source="vueDeFace" width-px="1000" height-px="1000" quality="90" extension="jpg" />
</Action>
</Rule>
</Field>
<Field key="productWidth" source-table="my_table_1">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition target="productWidth" operator="EMPTY" />
<Condition source="largeurDuProduit" operator="NOT_EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_NUMBER">
<Copy source="largeurDuProduit" precision="2" round="UP" />
</Action>
</Rule>
</Field>
<Field key="priceTTC" source-table="my_table_1">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition target="priceTTC" operator="EMPTY" />
<Condition target="priceHT" operator="NOT_EMPTY" />
<Condition source="tva" operator="EQUALS">
<Value>19.6</Value>
</Condition>
</Condition-Group>
</Conditions>
<Action type="SET_NUMBER">
<Template precision="2" round="DOWN">
<![CDATA[
{{source("prixHT")}} * 19.6
]]>
</Template>
</Action>
</Rule>
</Field>
<Field key="power" source-table="my_table_1">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition target="power" operator="EMPTY" />
<Condition target="puissance@laveVaisselle" operator="NOT_EMPTY" />
<Condition source="erp" operator="EQUALS">
<Value>laveVaisselle</Value>
</Condition>
</Condition-Group>
</Conditions>
<Action type="SET_NUMBER">
<Copy source="puissance@laveVaisselle" precision="2" round="UP" />
</Action>
</Rule>
<Rule priority="2">
<Conditions>
<Condition-Group>
<Condition target="power" operator="EMPTY" />
<Condition target="puissance@frigo" operator="NOT_EMPTY" />
<Condition source="erp" operator="EQUALS">
<Value>frigo</Value>
</Condition>
</Condition-Group>
</Conditions>
<Action type="SET_NUMBER">
<Copy source="puissance@frigo" precision="2" round="UP" />
</Action>
</Rule>
<Rule priority="3">
<Conditions>
<Condition-Group>
<Condition target="power" operator="EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_NUMBER">
<Value>10</Value>
</Action>
</Rule>
</Field>
<Field key="color" source-table="my_table_1">
<Rule priority="1">
<Action type="SET_OPTION">
<HashMap source="couleur">
<Entry source="rouge" target="red" />
<Entry source="bordeaux" target="red" />
<Entry source="magenta" target="red" />
<Entry source="bleu" target="blue" />
<Entry source="azure" target="blue" />
<Entry source="petrol" target="blue" />
</HashMap>
</Action>
</Rule>
</Field>
<Field key="length" source-table="my_table_1">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition source="typology" operator="EQUALS">
<Value>phone</Value>
</Condition>
</Condition-Group>
</Conditions>
<Action type="SET_NUMBER">
<Copy source="longueur@telephone" />
</Action>
</Rule>
<Rule priority="2">
<Conditions>
<Condition-Group>
<Condition source="typology" operator="EQUALS">
<Value>breadMaker</Value>
</Condition>
</Condition-Group>
</Conditions>
<Action type="SET_NUMBER">
<Copy source="longueur@machineAPain" />
</Action>
</Rule>
</Field>
</Rules>
</Rules-Engine>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
File structure
xml
<Rules-Engine table="PRODUCTS_RETAILERX" account="89h6797-2990a-345s78-90gh6-8klm89jlm78">
<Source-Tables />
<Rules />
</Rules-Engine>
1
2
3
4
2
3
4
XPath | Description | Occurs |
---|---|---|
Rules-Engine | The root element. | 1 |
@table | Target table key | 1 |
@account | Target account key | 1 |
Source-Tables | List of source tables | 1 |
Rules | All rules for each attributes | 1 |
Mapping rules may only be imported on shared tables
You cannot import mapping rules on tables that are not shared with you.
Source tables
Source-Tables
make it possible to reconcile items from several tables, by linking the identifiers of these tables to each other.
Example: the EAN identifier of my product table is equivalent to the EAN 13 identifier of the table that was shared with me by my partner.
xml
<Rules-Engine table="PRODUCTS_RETAILERX" account="89h6797-2990a-345s78-90gh6-8klm89jlm78">
<Source-Tables>
<Table key="PRODUCTS_BRANDX" source-identifier="EAN_13" target-identifier="EAN" />
</Source-Tables>
<Rules />
</Rules-Engine>
1
2
3
4
5
6
2
3
4
5
6
XPath | Description | Occurs |
---|---|---|
Table | For each source table | 1..5 |
@key | Source table key | 1 |
@source-identifier | Source identifier key | 1 |
@target-identifier | Target identifier key | 1 |
Rules
Info
The examples below correspond to the examples presented in the Rules Engine documentation. Make sure you read this documentation carefully to understand these examples.
Rules can be created for each target attribute Identifier
| Classification
| Field
of the target table. For example for a target Field
the main structure will be:
xml
<Rules-Engine table="PRODUCTS_RETAILERX" account="89h6797-2990a-345s78-90gh6-8klm89jlm78">
<Source-Tables>
<Table key="PRODUCTS_BRANDX" source-identifier="EAN_13" target-identifier="EAN" />
</Source-Tables>
<Rules>
<Field key="LABEL" source-table="PRODUCTS_BRANDX">
<Rule priority="1" name="">
<Conditions />
<Action />
</Rule>
</Field>
</Rules>
</Rules-Engine>
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
XPath | Description | Occurs |
---|---|---|
Rules/Identifier | For each target Identifier | 0..5 |
Rules/Classification | For each target Classification | 0..5 |
Rules/Field | For each target Field | 0..* |
Regardless the attribute type you have to set the following attributes:
XPath | Description | Occurs |
---|---|---|
@key | Key of the target Identifier | Classification | Field | 1 |
@source-table | Which source table must be used for this target field. Remember that you can use multiple source tables, but only one source table by target field. The key must refer a table defined in Source-Tables | 1 |
Rule | For rule | 1..1000 |
Rule/@priority | You can have multiple rules on a field, they will be executed by priority. | 1 |
Rule/@name | You can give a name to your rule. | 0..1 |
Rule/Conditions | Defines in which conditions the rule must be executed. | 0..1 |
Rule/Action | Defines the action that must be done. Actions available depends on the data type of the target. | 1 |
A complete example would be:
xml
<Rules-Engine table="PRODUCTS_RETAILERX" account="89h6797-2990a-345s78-90gh6-8klm89jlm78">
<Source-Tables>
<Table key="PRODUCTS_BRANDX" source-identifier="EAN_13" target-identifier="EAN" />
</Source-Tables>
<Rules>
<Field key="LABEL" source-table="PRODUCTS_BRANDX">
<Rule priority="1" name="Automate Label from Title">
<Conditions>
<Condition-Group>
<Condition source="TITLE" operator="NOT_EMPTY" />
<Condition target="LABEL" operator="EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_TEXT">
<Copy source="TITLE" trim-spaces="true" />
</Action>
</Rule>
</Field>
</Rules>
</Rules-Engine>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Example:
If
titleEn
in the destination table is empty andlabel
in the destination table is non-empty Then copy intitleEn
the value oflabel
(which also belongs to the target table, in this case we are copying fields within the same table). Before copying the value, remove the spaces at the beginning and end of the string (trim-spaces="true"
)
xml
<Field key="titleEn" source-table="PRODUCTS_BRANDX">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition target="titleEn" operator="EMPTY" />
<Condition target="label" operator="NOT_EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_TEXT">
<Copy target="label" trim-spaces="true" />
</Action>
</Rule>
</Field>
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
Conditions
xml
<Conditions>
<Condition-Group>
<Condition source="TITLE" operator="NOT_EMPTY" />
<Condition target="LABEL" operator="EMPTY" />
</Condition-Group>
</Conditions>
1
2
3
4
5
6
2
3
4
5
6
XPath | Description | Occurs |
---|---|---|
Condition-Group | Within a Condition-Group each Condition is interpreted with a AND logic. If you have several Condition-Group they are interpreted with a OR logic. | 1..* |
Condition | For each Condition | 1..* |
Condition/@source | The key of the source Identifier | Classification | Field | 1 |
Condition/@target | The key of the target Identifier | Classification | Field | 1 |
Condition/@operator | ENUM that depends on the type of the attribute. See below. | 1 |
Condition/Value | See details below | 0..* |
Condition/@use | Used to specify the value to be used for the condition. If the use attribute is not specified, the value of the source or target (depending on what is specified for target or source ) is used. See below for the different possible values depending on the type of source or target. | 0..1 |
Key points:
- Conditions can be set on source or target attributes
- You can have multiple conditions on the same attribute
- Conditions in a group is interpreted with a AND logic, every condition must be true for the group to be true
- You can have multiple groups, they are interpreted with a OR logic, at least one group must be true
- Nesting group of conditions is not allowed
Examples:
In the example below, titleEn
must be empty AND label
must be non-empty.
xml
<Conditions>
<Condition-Group>
<Condition target="titleEn" operator="EMPTY" />
<Condition target="label" operator="NOT_EMPTY" />
</Condition-Group>
</Conditions>
1
2
3
4
5
6
2
3
4
5
6
In the example below, titleEn
must be empty AND label
must be non-empty, or description
must be non-empty.
In other words: (titleEn == "" && label !== "") || description !== ""
xml
<Conditions>
<Condition-Group>
<Condition target="titleEn" operator="EMPTY" />
<Condition target="label" operator="NOT_EMPTY" />
</Condition-Group>
<Condition-Group>
<Condition target="description" operator="NOT_EMPTY" />
</Condition-Group>
</Conditions>
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Operator for Field with type SINGLE-LINE-TEXT, LONG-TEXT, HTML-TEXT
Operator | Description | Additional parameters |
---|---|---|
EMPTY | Is empty | None |
NOT_EMPTY | Is not empty | None |
CONTAINS | Contains a value (insensitive to case and accents) | Need a Value see below |
EQUALS | Strictly equals to a value (case sensitive and accents) | Need a Value see below |
STARTS_WITH | Starts with a value (case sensitive and accents) | Need a Value see below |
ENDS_WITH | Ends with a value (case sensitive and accents) | Need a Value see below |
xml
<Condition target="LABEL" operator="STARTS_WITH">
<Value>Ipod - <Value>
</Condition>
1
2
3
2
3
Operator for Field with type NUMBER, DATE, DATE-TIME
Operator | Description | Additional parameters |
---|---|---|
EMPTY | Is empty | None |
NOT_EMPTY | Is not emptu | None |
LESS_THAN | Is less than a value | Need a Value see below |
LESS_THAN_OR_EQUAL | Is less than or equal to a value | Need a Value see below |
GREATER_THAN | Is greater than a value | Need a Value see below |
GREATER _THAN_OR_EQUAL | Is greater than or equal to a value | Need a Value see below |
EQUALS | Strictly equals | Need a Value see below |
xml
<Condition target="PRICE" operator="LESS_THAN">
<Value>100.4<Value>
</Condition>
1
2
3
2
3
- For NUMBER, the value must be a number. So 0.3 is valid, 0,3 is not valid.
- For DATE and DATE-TIME the value must follow YYYY-MM-DDTHH:mm:ss.sssZ, you can read more here: view link
Operator for Units on Fields with type NUMBER
To apply a condition on a NUMBER field unit, you need to specify that you want to use that unit and not the value.
Operator | Description | Additional parameters |
---|---|---|
EMPTY | Is empty | None |
NOT_EMPTY | Is not empty | None |
EQUALS | Is equal to a suffix key | Need a Value see below |
NOT_EQUALS | Is different from a suffix key or empty | Need a Value see below |
CONTAINS | Contains a part of the suffix key | Need a Value see below |
STARTS_WITH | Starts with a part of the suffix key | Need a Value see below |
ENDS_WITH | Ends with a part of the suffix key | Need a Value see below |
xml
<Condition source="PRICE" use="SUFFIX_KEY" operator="EQUALS" >
<Value>EURO</Value>
</Condition>
1
2
3
2
3
Operator for Classification or Field with type SINGLE-SELECT, MULTIPLE-SELECT, MULTIPLE_SELECT_QUANTIFIED, MULTIPLE-SELECT-QUANTIFIED-WITH-COMMENTS
Operator | Description | Additional parameters |
---|---|---|
EMPTY | Is empty | None |
NOT_EMPTY | Is not empty | None |
EQUALS | Strictly equals to a value | Need a Value see below. The value is the key of the Option/Category. |
NOT_EQUALS | Not equals to a value | Need a Value see below. The value is the key of the Option/Category. |
IN | Equals to one of the values | Need a Value see below. The value is the key of the Option/Category. |
NOT_IN | Is equals to none of the values | Need a Value see below. The value is the key of the Option/Category. |
xml
<Condition target="COLOR" operator="NOT_IN">
<Value>RED</Value>
<Value>BLUE</Value>
</Condition>
1
2
3
4
2
3
4
Operator for Field with type IDENTIFIER
Operator | Description | Additional parameters |
---|---|---|
EMPTY | Is empty | None |
NOT_EMPTY | Is not empty | None |
CONTAINS | Contains a value (insensitive to case and accents) | Need a Value see below |
EQUALS | Strictly equals to a value (case sensitive and accents) | Need a Value see below |
STARTS_WITH | Starts with a value (case sensitive and accents) | Need a Value see below |
ENDS_WITH | Ends with a value (case sensitive and accents) | Need a Value see below |
IN | Equals to one of the values (case sensitive and accents) | Need a Value see below |
NOT_IN | Is equals to none of the values (case sensitive and accents) | Need a Value see below |
xml
<Condition target="EAN_13" operator="IN">
<Value>1234567890123<Value>
<Value>1234567890124<Value>
</Condition>
1
2
3
4
2
3
4
Operator for Field with type IMAGE, ATTACHMENT
Operator | Description | Additional parameters |
---|---|---|
EMPTY | Is empty | None |
NOT_EMPTY | Is not empty | None |
Actions
There can only be one action done on the target field only. There are different types of actions depending on the type of target field.
Actions for target Field with type SINGLE-LINE-TEXT, LONG-TEXT, HTML-TEXT
Then the Action/@type
must be SET_TEXT
. Then you can use these actions:
Copy
xml
<Action type="SET_TEXT">
<Copy source="color" use="title-local" lang="fra" remove-carriage-returns="true" trim-spaces="true" />
</Action>
1
2
3
2
3
XPath | Description | Occurs |
---|---|---|
@source | The key of the Identifier | Classification | Field | 1 |
@use | If the source is a Classification or a List, you must define if you want to use title | title-local | key | 0..1 |
@lang | If you have set @use=title-local then you must define which language must be used. If the language does not exist, a fallback is done on the default language. | 0..1 |
@remove-carriage-returns | Set true to remove carriage returns | 0..1 |
@trim-spaces | Set true to trim spaces | 0..1 |
- If the source is of the Multiple select type, the options are joined by
;
- If the source is of the Multiple select quantified type, the options are joined by
;
and we apply the following template:[quantity]: [value]
- If the source is of the Multiple select quantified with comments type, the options are joined by
;
and we apply the following template:[quantity]: [value], [comment]
Value
xml
<Action type="SET_TEXT">
<Value>Hello world</Value>
</Action>
1
2
3
2
3
You can use this to set a default value.
Template
This actions allows to concatenate texts.
xml
<Action type="SET_TEXT">
<Template trim-spaces="true">
<![CDATA[
<b>Composition</b>
<br></br>
{{source("COMPOSITION")}}
<br></br>
<br></br>
<b>Materials</b>
<br></br>
{{source("MATERIALS","title")}}
]]>
</Template>
</Action>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
The notation {{source}}
allows to reference a source Identifier
| Classification
| Field
. The first value is the key of the attribute.
- If the key contains a double quote, then it must doubled:
source("MORE_THAN_100""_SCREEN")
- The second parameter is used for Classifications or List, you can choose between
title
|title-local
|key
- The third parameter is to set the language if you have set
title-local
for the second parameter
Best practice
Do the concatenation only if all attributes used are not empty. For this use the conditions.
Actions for target Field with type NUMBER
Then the Action/@type
must be SET_NUMBER
. Then you can use these actions:
Copy
xml
<Action type="SET_NUMBER">
<Copy source="PRICE" precision="2" round="UP" />
</Action>
1
2
3
2
3
XPath | Description | Occurs |
---|---|---|
@source | The key of a Field with type NUMBER | 1 |
@precision | Decimal places | 1 |
@round | Round method, you can choose between: UP , DOWN , CEILING and FLOOR , HALF_UP , HALF_DOWN . You can read more about each option here | 1 |
Value
xml
<Action type="SET_NUMBER">
<Value>12.3</Value>
</Action>
1
2
3
2
3
You can use this to set a default value.
Template
For numbers it allows to do calculations.
xml
<Action type="SET_NUMBER">
<Template precision="0" round="CEILING">
<![CDATA[
{{source("WIDTH_MM")}} / 10
]]>
</Template>
</Action>
1
2
3
4
5
6
7
2
3
4
5
6
7
You can use:
*
for the multiplication/
for the division+
for the addition-
for the substraction- You can also use parentheses
Apply a unit
To apply a suffix you have to specify within the Action the field NUMBER, that unit.
xml
<Action type="SET_NUMBER">
<Copy source="PRICE" precision="2" round="UP" suffix="EURO"/>
</Action>
1
2
3
2
3
Actions for target Field with type SINGLE-SELECT
Then the Action/@type
must be SET_OPTION
. Then you can use these actions:
Map
xml
<Action type="SET_OPTION">
<Map source="MAIN_COLOR">
<Entry source="RED" target="RED" />
<Entry source="BURGUNDY" target="RED" />
<Entry source="MAGENTA" target="RED" />
<Entry source="BLUE" target="BLUE" />
<Entry source="AZURE" target="BLUE" />
<Entry source="PETROL" target="BLUE" />
</Map>
</Action>
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
XPath | Description | Occurs |
---|---|---|
@source | The key of a Field with type SINGLE-SELECT or the key of a Classification | 1 |
Entry | For each Option | 1..* |
Entry/@source | The key of the source Option | 1 |
Entry/@target | The key of the target Option | 1 |
Value
xml
<Action type="SET_OPTION">
<Value>RED</Value>
</Action>
1
2
3
2
3
You can use this to set a default value. The value must be a valid Option key of the target Field.
Actions for target Field with type MULTIPLE-SELECT, MULTIPLE-SELECT-QUANTIFIED et MULTIPLE-SELECT-QUANTIFIED-WITH-COMMENTS
Then the Action/@type
must be SET_OPTIONS
. Then you can use these actions:
Map
xml
<Action type="SET_OPTION">
<Map source="COLORS">
<Entry source="RED" target="RED" />
<Entry source="BURGUNDY" target="RED" />
<Entry source="MAGENTA" target="RED" />
<Entry source="BLUE" target="BLUE" />
<Entry source="AZURE" target="BLUE" />
<Entry source="PETROL" target="BLUE" />
</Map>
</Action>
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
XPath | Description | Occurs |
---|---|---|
@source | The key of a Field with type SINGLE-SELECT or the key of a Classification | 1 |
Entry | For each Option | 1..* |
Entry/@source | The key of the source Option | 1 |
Entry/@target | The key of the target Option | 1 |
Value
xml
<Action type="SET_OPTIONS">
<Value>RED</Value>
<Value>BLUE</Value>
</Action>
1
2
3
4
2
3
4
You can use this to set a default value. The value must be a valid Option key of the target Field.
For Fields
with type MULTIPLE-SELECT-QUANTIFIED
you can set:
xml
<Value quantity="2">HDMI</Value>
1
For Fields
with type MULTIPLE-SELECT-QUANTIFIED-WITH-COMMENTS
you can set:
xml
<Value quantity="2" comment="1 hdmi 3.1 and 1 hdmi 2.0">HDMI</Value>
1
Actions for target Classification
Then the Action/@type
must be SET_OPTION
. Then you can use these actions:
Map
xml
<Action type="SET_CATEGORY">
<Map source="TYPOLOGY">
<Entry source="laveVaisselle" target="DISHWASHER" />
<Entry source="frigo" target="FRIDGE" />
<Entry source="réfrigérateur" target="FRIDGE" />
</Map>
</Action>
1
2
3
4
5
6
7
2
3
4
5
6
7
XPath | Description | Occurs |
---|---|---|
@source | The key of a Field with type SINGLE-SELECT or the key of a Classification | 1 |
Entry | For each Option | 1..* |
Entry/@source | The key of the source Option/Category | 1 |
Entry/@target | The key of the target Category | 1 |
Value
xml
<Action type="SET_CATEGORY">
<Value>FRIDGE</Value>
</Action>
1
2
3
2
3
You can use this to set a default value. The value must be a valid Category key of the target Classification.
Actions for target Field with type IMAGE
Then the Action/@type
must be SET_IMAGE
. Then you can use these actions:
Copy
xml
<Action type="SET_IMAGE">
<Copy source="FRONT_VIEW" width-px="1000" height-px="1000" quality="90" format="jpg" />
</Action>
1
2
3
2
3
XPath | Description | Occurs |
---|---|---|
@source | The key of a Field with type IMAGE | 1 |
width-px | Optional to resize the width of the image | 0..1 |
height-px | Optional to resize the height of the image | 0..1 |
quality | Optional to change the quality and size of the file. A number from 1 to 100. | 0..1 |
format | Optional to force the format of the image to jpg or png | 0..1 |
Actions for target Field with type ATTACHMENT
Then the Action/@type
must be SET_ATTACHMENT
. Then you can use these actions:
Copy
xml
<Action type="SET_ATTACHMENT">
<Copy source="INSTRUCTIONS" />
</Action>
1
2
3
2
3
XPath | Description | Occurs |
---|---|---|
@source | The key of a Field with type ATTACHMENT | 1 |
Outputs
Property | Type | Description |
---|---|---|
YES all rules have been imported without warning, NO at least one rule has generated a warning. | ||
A report file of warnings and errors. |
Rules life cycle
The file is interpreted as an exhaustive file.
Warning!
Therefore rules that are in the file are updated or created, and rules that are not in the file are removed.
Limits and additional notes
Element | Limit |
---|---|
Fields with rules | 5 000 |
Rules by field | 1 000 |
Source tables | 5 |
Rules by table | 20 000 |