Automation use cases
Create a compound identifier
When a product must be uniquely identified by a combination of fields, for example : Supplier (SINGLE-SELECT) and Supplier reference (SINGLE-LINE-TEXT), you can model this with a computed identifier. Uniqueness is enforced at identifier level, two items cannot share the same composed value.
This requires three elements in the table schema:
1. The target identifier - carries the uniqueness constraint:
xml
<Identifiers>
<Identifier key="SUPPLIER-SUPPLIER_REF" index="1" level="PRODUCT">
<Title>Supplier - supplier ref</Title>
</Identifier>
</Identifiers>1
2
3
4
5
2
3
4
5
2. The source fields - carry the individual values:
xml
<Fields>
<Field key="SUPPLIER" type="SINGLE-SELECT" level="PRODUCT">
<Title>Supplier</Title>
<Options>
<Option key="SUPPLIERX"><Title>Supplier X</Title></Option>
<Option key="SUPPLIERY"><Title>Supplier Y</Title></Option>
</Options>
</Field>
<Field key="SUPPLIER_REF" type="SINGLE-LINE-TEXT" level="PRODUCT">
<Title>Supplier reference</Title>
</Field>
</Fields>1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
3. The formulas - compute the identifier value:
xml
<Formulas>
<Identifier key="SUPPLIER-SUPPLIER_REF">
<!-- Remove the identifier if one of the components is empty, so that uniqueness is not enforced on incomplete data -->
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition source="SUPPLIER" operator="EMPTY"/>
</Condition-Group>
<Condition-Group>
<Condition source="SUPPLIER_REF" operator="EMPTY"/>
</Condition-Group>
</Conditions>
<Action type="REMOVE_VALUE"/>
</Rule>
<!-- Build the identifier when both fields are filled -->
<Rule priority="2">
<Conditions>
<Condition-Group>
<Condition source="SUPPLIER" operator="NOT_EMPTY"/>
<Condition source="SUPPLIER_REF" operator="NOT_EMPTY"/>
</Condition-Group>
</Conditions>
<Action type="SET_TEXT">
<Template trim-spaces="true" engine="twig.2">
<![CDATA[
{{ targetItem.fields.SUPPLIER.value.data }}-{{ targetItem.fields.SUPPLIER_REF.value.data }}
]]>
</Template>
</Action>
</Rule>
</Identifier>
</Formulas>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
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
The first rule removes the identifier when either component is empty, this prevents uniqueness from being enforced on incomplete data. The second rule concatenates both values when they are both filled.
TIP
The order of concatenation matters, SUPPLIER-SUPPLIER_REF and SUPPLIER_REF-SUPPLIER are treated as different identifiers.
Automate volume
When a product's volume can be derived from its dimensions, you can compute it automatically with a formula.
1. The target field - carry the automated value:
xml
<Fields>
<Field key="VOLUME_CM_3" type="NUMBER" level="PRODUCT">
<Title>Volume</Title>
<Suffix>cm3</Suffix>
<Precision>0</Precision>
</Field>
</Fields>1
2
3
4
5
6
7
2
3
4
5
6
7
2. The source fields - carry the individual values:
xml
<Fields>
<Field key="WIDTH_CM" type="NUMBER" level="PRODUCT">
<Title>Width</Title>
<Suffix>cm</Suffix>
<Precision>0</Precision>
</Field>
<Field key="HEIGHT_CM" type="NUMBER" level="PRODUCT">
<Title>Height</Title>
<Suffix>cm</Suffix>
<Precision>0</Precision>
</Field>
<Field key="DEPTH_CM" type="NUMBER" level="PRODUCT">
<Title>Depth</Title>
<Suffix>cm</Suffix>
<Precision>0</Precision>
</Field>
</Fields>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
3. The formulas - compute the volume when all three dimensions are filled:
xml
<Formulas>
<Field key="VOLUME_CM_3">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition source="WIDTH_CM" operator="NOT_EMPTY" />
<Condition source="HEIGHT_CM" operator="NOT_EMPTY" />
<Condition source="DEPTH_CM" operator="NOT_EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_NUMBER">
<Template precision="0" round="CEILING" engine="twig.2">
<![CDATA[
{{ targetItem.fields.WIDTH_CM.value.data }} * {{ targetItem.fields.HEIGHT_CM.value.data }} * {{ targetItem.fields.DEPTH_CM.value.data }}
]]>
</Template>
</Action>
</Rule>
</Field>
</Formulas>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
Limit selectable options
You can restrict the selectable values of a list field based on the value of another field, using the SET_SELECTABLE_OPTIONS action. This ensures users can only select relevant options and prevents inconsistent data.
TIP
If multiple values share the same limitation, group them in a single rule instead of creating one rule per value.
Based on a field value
In this example, the selectable values of DEEE_SCALE depend on the value of SUPPLIER.
1. The target field - hold all possible options:
xml
<Fields>
<Field key="DEEE_SCALE" type="SINGLE-SELECT" level="PRODUCT">
<Title>DEEE scale</Title>
<Options>
<Option key="DEEE-1"><Title>DEEE 1</Title></Option>
<Option key="DEEE-2"><Title>DEEE 2</Title></Option>
<Option key="DEEE-3"><Title>DEEE 3</Title></Option>
</Options>
</Field>
</Fields>1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
2. The source field - hold all supplier values:
xml
<Fields>
<Field key="SUPPLIER" type="SINGLE-SELECT" level="PRODUCT">
<Title>Supplier</Title>
<Options>
<Option key="SUPPLIER-1"><Title>Supplier 1</Title></Option>
<Option key="SUPPLIER-2"><Title>Supplier 2</Title></Option>
<Option key="SUPPLIER-3"><Title>Supplier 3</Title></Option>
</Options>
</Field>
</Fields>1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
3. The formula - limit the available option based on supplier:
xml
<Formulas>
<Field key="DEEE_SCALE">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition source="SUPPLIER" operator="IN">
<Value>SUPPLIER-1</Value>
<Value>SUPPLIER-2</Value>
</Condition>
</Condition-Group>
</Conditions>
<Action type="SET_SELECTABLE_OPTIONS">
<Value>DEEE-1</Value>
<Value>DEEE-2</Value>
</Action>
</Rule>
<Rule priority="2">
<Conditions>
<Condition-Group>
<Condition source="SUPPLIER" operator="IN">
<Value>SUPPLIER-3</Value>
</Condition>
</Condition-Group>
</Conditions>
<Action type="SET_SELECTABLE_OPTIONS">
<Value>DEEE-1</Value>
<Value>DEEE-3</Value>
</Action>
</Rule>
</Field>
</Formulas>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
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
Based on a classification
In this example, the selectable values of SIZE depend on the item's TYPOLOGY classification.
TIP
It is a best practice to limit options by category instead of creating one field per category.
1. The target field - hold all possible size options:
xml
<Fields>
<Field key="SIZE" type="SINGLE-SELECT" level="PRODUCT">
<Title>Size</Title>
<Options>
<Option key="39"><Title>39</Title></Option>
<Option key="40"><Title>40</Title></Option>
<Option key="41"><Title>41</Title></Option>
<Option key="42"><Title>42</Title></Option>
<Option key="S"><Title>S</Title></Option>
<Option key="M"><Title>M</Title></Option>
<Option key="L"><Title>L</Title></Option>
<Option key="XL"><Title>XL</Title></Option>
</Options>
</Field>
</Fields>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2. The source classification - hold all possible categories:
xml
<Classifications>
<Classification key="TYPOLOGY">
<Title>Typology</Title>
<Categories>
<Category key="SHOES"><Title>Shoes</Title></Category>
<Category key="T-SHIRT"><Title>T-shirt</Title></Category>
<Category key="SHIRT"><Title>Shirt</Title></Category>
</Categories>
</Classification>
</Classifications>1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
3. The formula - limit available options based on category:
xml
<Formulas>
<Field key="SIZE">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition source="TYPOLOGY" operator="EQUALS">
<Value>SHOES</Value>
</Condition>
</Condition-Group>
</Conditions>
<Action type="SET_SELECTABLE_OPTIONS">
<Value>39</Value>
<Value>40</Value>
<Value>41</Value>
<Value>42</Value>
</Action>
</Rule>
<Rule priority="2">
<Conditions>
<Condition-Group>
<Condition source="TYPOLOGY" operator="IN">
<Value>T-SHIRT</Value>
<Value>SHIRT</Value>
</Condition>
</Condition-Group>
</Conditions>
<Action type="SET_SELECTABLE_OPTIONS">
<Value>S</Value>
<Value>M</Value>
<Value>L</Value>
<Value>XL</Value>
</Action>
</Rule>
</Field>
</Formulas>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
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
Automate a status field
You can automatically compute a status field based on conditions on other fields. This is useful to model a process, for example: the publication status of a product on a website.
1. The target field - list all possible statuses:
xml
<Fields>
<Field key="WEB_STATUS" type="SINGLE-SELECT" level="PRODUCT">
<Title>Web status</Title>
<Options>
<Option key="PUBLISHED" color="GREEN"><Title>Published</Title></Option>
<Option key="READY_FOR_WEB" color="BLUE"><Title>Ready for web</Title></Option>
<Option key="TODO" color="ORANGE"><Title>To do</Title></Option>
</Options>
</Field>
</Fields>1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
2. The source field - hold item values:
xml
<Fields>
<Field key="WEB_PUBLICATION_DATE" type="DATE" level="PRODUCT">
<Title>Web publication date</Title>
</Field>
<Field key="WEB_COMPLIANCE" type="SINGLE-SELECT" level="PRODUCT">
<Title>Web compliance</Title>
<Options>
<Option key="VALID"><Title>Valid</Title></Option>
</Options>
</Field>
</Fields>1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
3. The formula - set status based on field values:
xml
<Formulas>
<Field key="WEB_STATUS">
<Rule priority="1">
<Conditions>
<Condition-Group>
<Condition source="WEB_PUBLICATION_DATE" operator="NOT_EMPTY" />
</Condition-Group>
</Conditions>
<Action type="SET_OPTION">
<Value>PUBLISHED</Value>
</Action>
</Rule>
<Rule priority="2">
<Conditions>
<Condition-Group>
<Condition source="WEB_COMPLIANCE" operator="EQUALS">
<Value>VALID</Value>
</Condition>
</Condition-Group>
</Conditions>
<Action type="SET_OPTION">
<Value>READY_FOR_WEB</Value>
</Action>
</Rule>
<Rule priority="3">
<Action type="SET_OPTION">
<Value>TODO</Value>
</Action>
</Rule>
</Field>
</Formulas>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
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
TIP
Rule priority 1 must match the last step of your process. The last rule (without conditions) acts as a default - it applies when none of the previous conditions are met.
Create a dynamic link
When you manage multiple item types: products, logistics units, spare parts, prices, you can generate an automatic link from one table to related items in another, without having to apply filters manually.
Create an HTML-TEXT field and populate it with a formula that builds a filtered URL pointing to the related items.
1. The target field - hold the item link:
xml
<Fields>
<Field key="UL_LINK" type="HTML-TEXT" level="PRODUCT">
<Title>Logistics unit link</Title>
</Field>
</Fields>1
2
3
4
5
2
3
4
5
2. The formula - Compute the item link:
xml
<Formulas>
<Field key="UL_LINK">
<Rule priority="1">
<Action type="SET_TEXT">
<Template trim-spaces="true" engine="twig.2">
<![CDATA[
{% set ean = targetItem.fields.EAN.value.data %}
{% set filter = base64_encode("[{\"fieldKey\": \"EAN\",\"operator\": \"equals\",\"criteria\": {\"list\": [\"" + ean + "\"]}}]") %}
<a target="_blank" href="https://app.product-live.com/redirect?tableKey=LOGISTICAL_UNIT&filters={{ filter }}">link</a>
]]>
</Template>
</Action>
</Rule>
</Field>
</Formulas>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
The formula reads the current item's EAN value, encodes a filter as Base64, and builds a URL pointing to the LOGISTICAL_UNIT table filtered on that value. See Access links for more details on how access links work.