Conditional Formatting > Examples β
Complete example β
XML Example
xml
<Table key="products">
<Title>Produits</Title>
<Color>RED</Color>
<Position>1</Position>
<Schema>
<Conditional-Formattings>
<Conditional-Formatting key="compliance" level="product">
<Title>Compliance</Title>
<Default-Status key="valid">
<Title>Valid</Title>
<Color>GREEN</Color>
</Default-Status>
<Statuses>
<Status key="unvalid">
<Title>Unvalid</Title>
<Color>RED</Color>
<Priority>1</Priority>
<Rules>
<Common>
<Field key="titleEn">
<Rule-Required />
<Rule-Min-Length min="3" />
<Rule-Max-Length max="27" />
</Field>
</Common>
<Specific classification="taxonomy" category="dress">
<Field key="material">
<Rule-Required />
</Field>
</Specific>
</Rules>
</Status>
<Status key="recommanded">
<Title>Recommanded</Title>
<Color>ORANGE</Color>
<Priority>2</Priority>
<Rules>
<Common>
<Field key="titleEn">
<Rule-Min-Length min="5" />
</Field>
</Common>
</Rules>
</Status>
</Statuses>
</Conditional-Formatting>
</Conditional-Formattings>
</Schema>
</Table>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
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
Rules specific to a type of field β
Rules on identifiers β
XML Example
xml
<Identifier key="ean">
<Rule-Required />
<Rule-Min-Length min="3" />
<Rule-Max-Length max="27" />
<Rule-Regex regex="^[0-9]{13}$" />
<Rule-Barcode type="EAN13" />
</Identifier>1
2
3
4
5
6
7
2
3
4
5
6
7
Rules on classifications β
XML Example
xml
<Classification key="typology">
<Rule-Required />
<Rule-Is-Leaf />
</Classification>1
2
3
4
2
3
4
Rules on SINGLE-LINE-TEXT or LONG-TEXT fields β
XML Example
xml
<Field key="titleEn">
<Rule-Required />
<Rule-Min-Length min="3" />
<Rule-Max-Length max="27" />
<Rule-Regex regex="^hello$" />
</Field>1
2
3
4
5
6
2
3
4
5
6
Rules on the HTML-TEXT field β
XML Example
xml
<Field key="description">
<Rule-Required />
</Field>1
2
3
2
3
Rules on the NUMBER field β
XML Example
xml
<Field key="price">
<Rule-Required />
<Rule-Less-Than value="3" />
<Rule-Greater-Than value="27" />
<Rule-Less-Than-Or-Equal value="3" />
<Rule-Greater-Than-Or-Equal value="27" />
<Rule-Decimal-Places precision="2" />
</Field>1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Rules on the IMAGE field β
XML Example
xml
<Field key="mainImage">
<Rule-Required />
<Rule-Min-Width-Px min="200" />
<Rule-Max-Width-Px max="1500" />
<Rule-Min-Height-Px min="27" />
<Rule-Max-Height-Px max="27" />
<Rule-Max-Size-Kb max="300" />
<Rule-Extension extension="jpg,png" />
<Rule-Color-Space name="RGB" />
<Rule-Color-Profile name="sRGB" />
</Field>1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Rules on the ATTACHMENT field β
XML Example
xml
<Field key="instructionsForUse">
<Rule-Required />
<Rule-Max-Size-Kb max="300" />
<Rule-Extension extension="jpg" />
</Field>1
2
3
4
5
2
3
4
5
Rules on the fields DATE or Field DATE-TIME β
XML Example
xml
<Field key="publication">
<Rule-Required />
</Field>1
2
3
2
3
Rules on the SINGLE-SELECT field β
XML Example
xml
<Field key="connectors">
<Rule-Required />
<Rule-Only-Active-Options />
</Field>1
2
3
4
2
3
4
Rules on the fields MULTIPLE-SELECT, MULTIPLE-SELECT-QUANTIFIED, MULTIPLE-SELECT-QUANTIFIED-WITH-COMMENTS, MULTIPLE-SELECT-WITH-COMMENTS β
XML Example
xml
<Field key="connectors">
<Rule-Required />
<Rule-Only-Limited-Options />
<Rule-Only-Active-Options />
<Rule-Min-Values min="2" />
<Rule-Max-Values max="15" />
</Field>1
2
3
4
5
6
7
2
3
4
5
6
7
The Condition rule β
Modeling of the constraint "This field must be filled in" β
TIP
This example illustrates the use of rules of the Rule-Condition type. To model this basic case, it is recommended to use the rule <Rule-Required />.
XML Example
xml
<Field key="title">
<Rule-Condition key="TITLE_IS_MANDATORY">
<Conditions>
<Condition-Group>
<Condition source="TITLE" operator="EMPTY" />
</Condition-Group>
</Conditions>
<Title>this field is mandatory</Title>
</Rule-Condition>
</Field>1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Modeling the constraint "The weight of the item must be less than the weight of the packed item" β
TIP
This example illustrates the use of rules of the Rule-Condition type. To model this basic case, it is recommended to use the rule <Rule-Must-Be-Less-Than-Another-Field field="ARTICLE_WEIGHT" />.
XML Example
xml
<Field key="ARTICLE_WEIGHT">
<Rule-Condition key="ARTICLE_WEIGHT_CHECK">
<Conditions>
<Condition-Group>
<Condition source="ARTICLE_WEIGHT" operator="LOWER_THAN">
<Field key="PACKAGED_ARTICLE_WEIGHT" />
</Condition>
</Condition-Group>
</Conditions>
<Title>The weight of the article must be lower than the total weight of the article (package included)</Title>
</Rule-Condition>
</Field>1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
Modeling the constraint "The title is mandatory on the product is a washing machine or an oven" β
XML Example
xml
<Field key="ARTICLE_WEIGHT">
<Rule-Condition key="ARTICLE_WEIGHT_CHECK">
<Conditions>
<Condition-Group>
<Condition source="CLASSIFICATION" operator="IN">
<Value>WASHER_DRYERS</Value>
<Value>OVENS</Value>
</Condition>
<Condition source="TITLE" operator="EMPTY" />
</Condition-Group>
</Conditions>
<Title>The field "title" is mandatory if the product is classified as a washing machine (WASHER_DRYERS) or an oven (OVENS)</Title>
</Rule-Condition>
</Field>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
Modeling of the constraint "This field is mandatory and must be less than 40 characters if the current product is a skirt or a skirt" β
XML Example
xml
<Field key="ARTICLE_WEIGHT">
<Rule-Condition key="TITLE_IS_MANDATORY">
<Conditions>
<Condition-Group>
<Condition source="TITLE" operator="EMPTY" />
<Condition source="CLASSIFICATION" operator="IN">
<Value>dress</Value>
<Value>skirt</Value>
</Condition>
</Condition-Group>
<Condition-Group>
<Condition source="TITLE" operator="LENGTH_GREATER_THAN" />
<Value>40</Value>
</Condition>
<Condition source="CLASSIFICATION" operator="IN">
<Value>dress</Value>
<Value>skirt</Value>
</Condition>
</Condition-Group>
</Conditions>
<Title>If the product is a skirt or a dress, the "Title" field is required and must be less than 40 characters long.</Title>
</Rule-Condition>
</Field>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
TIP
Here the condition translates to:
The condition is met if one of the two conditions below is met:
- The title is empty and the product is a dress or a skirt
- The title is longer than 40 characters and the product is a dress or a skirt
Limit illustration β
Example 1 β
In the example below, we count:
- 3 rules on the common fields of the
unvalidstatus of the CFcompliancefield - 1 rule on the common fields of the
recommendedstatus of the CFcompliancefield - 6 rules on the common fields of the
unvalidstatus of the CFsupplierfield
xml
<Table key="products">
<Schema>
<Conditional-Formattings>
<Conditional-Formatting key="compliance" level="product">
<Title>Compliance</Title>
<Default-Status key="valid">
<Title>Valid</Title>
<Color>GREEN</Color>
</Default-Status>
<Statuses>
<Status key="unvalid">
<Title>Unvalid</Title>
<Color>RED</Color>
<Priority>1</Priority>
<Rules>
<Common>
<Field key="titleEn">
<Rule-Required />
<Rule-Min-Length min="3" />
<Rule-Max-Length max="27" />
</Field>
</Common>
</Rules>
</Status>
<Status key="recommanded">
<Title>Recommanded</Title>
<Color>ORANGE</Color>
<Priority>2</Priority>
<Rules>
<Common>
<Field key="titleEn">
<Rule-Min-Length min="5" />
</Field>
</Common>
</Rules>
</Status>
</Statuses>
</Conditional-Formatting>
<Conditional-Formatting key="supplier" level="product">
<Title>Compliance</Title>
<Default-Status key="valid">
<Title>Valid</Title>
<Color>GREEN</Color>
</Default-Status>
<Statuses>
<Status key="unvalid">
<Title>Unvalid</Title>
<Color>RED</Color>
<Priority>1</Priority>
<Rules>
<Common>
<Field key="titleEn">
<Rule-Required />
<Rule-Min-Length min="3" />
<Rule-Max-Length max="27" />
</Field>
<Field key="desciptionEn">
<Rule-Required />
<Rule-Min-Length min="10" />
<Rule-Max-Length max="100" />
</Field>
</Common>
</Rules>
</Status>
</Statuses>
</Conditional-Formatting>
</Conditional-Formattings>
</Schema>
</Table>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
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
Example 2 β
In the example below:
- The
shoescategory, in theunvalidstatus counts 1 rule - The
dresscategory, in theunvalidstatus counts 4 rule - The
dresscategory, in therecommendedstatus counts 3 rules
xml
<Table key="products">
<Schema>
<Conditional-Formattings>
<Conditional-Formatting key="compliance" level="product">
<Title>Compliance</Title>
<Default-Status key="valid">
<Title>Valid</Title>
<Color>GREEN</Color>
</Default-Status>
<Statuses>
<Status key="unvalid">
<Title>Unvalid</Title>
<Color>RED</Color>
<Priority>1</Priority>
<Rules>
<Specific classification="taxonomy" category="shoes">
<Field key="gender">
<Rule-Required />
</Field>
</Specific>
<Specific classification="taxonomy" category="dress">
<Field key="gender">
<Rule-Required />
</Field>
<Field key="collarShape">
<Rule-Required />
<Rule-Min-Length min="10" />
<Rule-Max-Length max="100" />
</Field>
</Specific>
</Rules>
</Status>
<Status key="recommanded">
<Title>Recommanded</Title>
<Color>ORANGE</Color>
<Priority>2</Priority>
<Rules>
<Specific classification="taxonomy" category="dress">
<Field key="type">
<Rule-Required />
<Rule-Min-Length min="10" />
<Rule-Max-Length max="100" />
</Field>
</Specific>
</Rules>
</Status>
</Statuses>
</Conditional-Formatting>
</Conditional-Formattings>
</Schema>
</Table>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
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
Example 3 β
- Below CF
compliancefield counts 14 rules.
xml
<Table key="products">
<Schema>
<Conditional-Formattings>
<Conditional-Formatting key="compliance" level="product">
<Title>Compliance</Title>
<Default-Status key="valid">
<Title>Valid</Title>
<Color>GREEN</Color>
</Default-Status>
<Statuses>
<Status key="unvalid">
<Title>Unvalid</Title>
<Color>RED</Color>
<Priority>1</Priority>
<Rules>
<Common>
<Field key="titleEn">
<Rule-Required />
<Rule-Min-Length min="3" />
<Rule-Max-Length max="27" />
</Field>
<Field key="desciptionEn">
<Rule-Required />
<Rule-Min-Length min="10" />
<Rule-Max-Length max="100" />
</Field>
</Common>
<Specific classification="taxonomy" category="shoes">
<Field key="gender">
<Rule-Required />
</Field>
</Specific>
<Specific classification="taxonomy" category="dress">
<Field key="gender">
<Rule-Required />
</Field>
<Field key="collarShape">
<Rule-Required />
<Rule-Min-Length min="10" />
<Rule-Max-Length max="100" />
</Field>
</Specific>
</Rules>
</Status>
<Status key="recommanded">
<Title>Recommanded</Title>
<Color>ORANGE</Color>
<Priority>2</Priority>
<Rules>
<Specific classification="taxonomy" category="dress">
<Field key="type">
<Rule-Required />
<Rule-Min-Length min="10" />
<Rule-Max-Length max="100" />
</Field>
</Specific>
</Rules>
</Status>
</Statuses>
</Conditional-Formatting>
</Conditional-Formattings>
</Schema>
</Table>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
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