Import / Export Related Sort Orders
This functionality is scheduled for deprecation in Perfion 5.8 2025-r3
Prerequisite
Any base feature (e.g. “Product”) may have other features in its configuration. If one of those other features is a selectable feature (e.g. “Category”), then the “Product” feature items can be categorized using “Category” feature items by creating a custom section in Perfion. In this section user can create a special view, where “Product” items will be shown in the right window and in the left window there will be “Category” items. Then user can select any “Category” feature item in the left window to filter out “Product” feature items in the right window. Example of such custom section use is shown in Figure 1, where CategorizerFeature feature is a “Category” feature (further called categorizer feature) and RelatedFeature is a “Product” feature (further called related feature).
In order to be able to sort related feature items for each categorizer feature item one has to enable “Sortable Related Items” data property for categorizer feature. If this data property is enabled, then one can change the order of related feature items in the right window by using order change buttons “up arrow” (Alt+Up) and “down arrow” (Alt+Down) (refer to Figure 1). After ordering RelatedFeature items for chosen CategorizerFeature item, the order values will be saved to Perfion database. The related feature items can be ordered independently for each categorizer item and related sort order import and export allows to import and export these orders.
Supported Feature Data Types
Related sort order supports the following feature data types:
Compound | Table | Search | Date | File | Image | Link | Number | String | Text |
No | No | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Compound data type is considered as deprecated while Table and Search data types are not supported, because they cannot have related sort orders.
Supported Feature Data Properties
Related sort orders data import depends on data properties and allows importing data only to those features which meet specifications. The table below shows which data properties are supported.
Data property | Categorizer feature | Related feature |
Selectable | Mandatory | Mandatory |
Selectable with sortable related items (Sortable Related Items) | Mandatory | - |
Import
In this section we will go into details how to specify import data and import related sort orders.
Data Format
The import data is table like data and can be specified as import data headers and import data values.
Related sort order import data format is shown in the table below.
Data header | Mandatory | Description |
Cat_Feature | Yes/No | Categorizer feature name or ID. If numeric value, then it will be treated as an ID and otherwise as a name. Format: string value, max 100 chars. It is a mandatory parameter if categorizer feature item is defined using its base value (Cat_Value) or localizable base value (Cat_Value_<LanguageCode>). If categorizer feature item is defined using ID, then this column is not used. Note, the name is case insensitive. |
Cat_ID Cat_Value Cat_Value_<LanguageCode> | Yes | Categorizer feature item ID, base value or localizable base value. Format: string value. It is a mandatory parameter. When categorizer feature item is defined by ID:
|
Rel_Feature | Yes/No | Related feature name or ID. If numeric value, then it will be treated as an ID and otherwise as a feature name. Format: string value, max 100 chars. It is a mandatory parameter if related feature item is defined using its base value (Rel_Value) or localizable base value (Rel_Value_<LanguageCode>). If related feature item is defined using ID, then this column is not used. Note, the name is case insensitive. |
Rel_ID Rel_Value Rel_Value_<LanguageCode> | Yes | Related feature item ID, base value or localizable base value. Format: string value. It is a mandatory parameter. When related feature item is defined by ID:
|
Order Rel_Order
| No | Related feature item order. Order and Rel_Order column names are aliases, e.g. one can use one or another and there is no difference how order data will be processed. Parameter is optional. Values: empty value or any 32-bit integer value <2147483647. The actual order value will be determined using order value defined in import data and the item row number. In case the order value is not defined (empty value or order data is not present in import data), then order value will be treated as if it is the maximum possible order value, e.g. 2147483647. The order values are relative. This means that the final order value will be determined by comparing order values from all items in the same context, but the final order value will be reassigned so it is suitable for import to Perfion. That also means that one can use negative values, mix values and also use duplicate order values. Refer to “Order Determination Rules” for more information how importer will determine related feature item order. |
Some other details about import data:
Data header names are case insensitive.
Data header order in import data is not important.
One can comment the data header in import data by using # prefix. For example, data header “#Cat_Feature” will be ignored by importer.
If “Order” data header is present in import data and all order values are defined, then row order in import data is not important.
Item Base Values
In order to define feature item base value one must define it using the full path from the root item. This is actual only when a feature is hierarchical and has hierarchy. To separate the nodes in the path the pipe (|) character is used.
Example
Example of hierarchical feature and how to define its values. The hierarchical feature is shown in Figure 2. The table below shows how all feature items of HierarchicalFeature can be defined in import data using a full path.
Item actual base value | Item root and parent nodes | Item full path |
VirtualItem1 | - | VirtualItem1 |
VirtualItem11 | VirtualItem1 | VirtualItem1|VirtualItem11 |
Item1 | VirtualItem1, VirtualItem11 | VirtualItem1| VirtualItem11|Item1 |
VirtualItem12 | VirtualItem1 | VirtualItem1|VirtualItem12 |
Item2 | VirtualItem1, VirtualItem12 | VirtualItem1| VirtualItem12|Item2 |
VirtualItem2 | - | VirtualItem2 |
Item3 | VirtualItem2 | VirtualItem2|Item3 |
Refer to “Example Using Various Order Values” to see an example how hierarchical data can be imported to Perfion.
Node Escaping
Item base value may have any characters if it is a String or Text type feature. In order to be able to distinguish between separate path nodes, the node’s value must not include the character used as a path separator or the path node must be escaped. One can use 4 delimiters (‘, “, $, #) for escaping.
The rules for path node escaping:
# | Rule | Example | Comment |
1 | The node value must be escaped if it contains a path separator (|) or one of 4 delimiter (‘, “, $, #) characters. Note 1. The node value must be escaped even if it is a single node in the path. Note 2. The same node escaping rules apply for hierarchical and not hierarchical features. | abc
| No escaping needed, because node value does not have separator or delimiter characters. |
Value vs. escaped value:
| Example of node values which has to be escaped, because they include either separator or delimiter character.
| ||
2 | Escaping can be done using any of 4 delimiters which is not used in the node’s value. Note 1. The delimiter use order is not important. | Value vs. escaped value:
|
|
3 | Node value may not have all 4 delimiter (‘, “, $, #) characters. | a’b”c$d#e | Illegal node value, which cannot be escaped, because it has all delimiter characters. |
4 | Node value escaping is independent for each node in the path. | Value vs. escaped value:
Path with escaped nodes: abc|’a|b|c’|”I’m”|I am | Node 1 and Node 4 do not need escaping. Node 2 and Node 3 must be escaped. |
5 | Node value can be escaped even if it does not have to be escaped. | Value: abc Valid escaped values:
| Escaping can be used even if there is no need for it. |
Order Determination Rules
The order values for import data items will be determined based on which data is defined in import data. The table below shows how order value will be determined:
Item row number in import data | Order value in import data | Actual order value | Final order value |
1 | 10 | 10 | 2 (10, 1) |
2 | (not defined) | 2147483647 | 6 (2147483647, 2) |
3 | 25 | 25 | 4 (25, 3) |
4 | -3 | -3 | 1 (-3, 4) |
5 | 14 | 14 | 3 (14, 5) |
6 | 25 | 25 | 5 (25, 6) |
7 | (not defined) | 2147483647 | 7 (2147483647, 7) |
The steps how the order is determined:
Actual order is determined for all items. If order values are not defined in import data (order value is empty or order column is not present) then it will be treated as if it is the maximum possible order value, e.g. 2147483647. This means that any order values defined in import data have priority over not defined values.
Items are sorted by actual order. Because not defined values are treated as if they have the maximum possible value, then those values will always be moved to the end of item list after this sorting.
Items will be sorted again by item row numbers. The second sorting ensures that all items are sorted correctly in case the actual order has duplicate values. In case order data is not present in import data, all items will have duplicate order values and order will be automatically determined by item row numbers.
The new order values are assigned. The importer will determine new order values as a final order values which start from 1 and it will also use sequential order values. The new orders will be reset for each context, which is based on all items which belong to a single categorizer feature item and a single related feature.
The items defined in import data may not include all possible items defined in Perfion. It is allowed to import related sort order data only for some items. In this case the orders for items defined in import data will be set exactly as they are defined in import data and the items which exist in Perfion will be added to the end. The importer will resort all items in Perfion for given context if there is at least 1 item present in import data for that context. The context in this case is all related feature items which belong to a single categorizer feature item and the single related feature. The concept is shown in the table below.
Context | Categorizer feature item | Related feature | Related feature item | Final order from import data | Final order from Perfion | Final order after import |
1 | Cat. item 1 | RelFeature1 | Rel. item 1 | 1 | 4 | 1 |
Cat. item 1 | RelFeature1 | Rel. item 2 | 2 | 5 | 2 | |
Cat. item 1 | RelFeature1 | Rel. item 3 | 3 | 6 | 3 | |
Cat. item 1 | RelFeature1 | Rel. item 4 | (item not defined) | 3 | 6 | |
Cat. item 1 | RelFeature1 | Rel. item 5 | (item not defined) | 1 | 4 | |
Cat. item 1 | RelFeature1 | Rel. item 6 | (item not defined) | 2 | 5 | |
2 | Cat. item 1 | RelFeature2 | Rel. item x1 | 1 | 5 | 1 |
Cat. item 1 | RelFeature2 | Rel. item x2 | 2 | 6 | 2 | |
Cat. item 1 | RelFeature2 | Rel. item x3 | 3 | 4 | 3 | |
3 | Cat. item 2 | RelFeature1 | Rel. item 1 | 1 | 6 | 1 |
Cat. item 2 | RelFeature1 | Rel. item 2 | (item not defined) | 7 | 3 | |
Cat. item 2 | RelFeature1 | Rel. item 3 | (item not defined) | 5 | 2 |
In the table we can see what the final order in Perfion will be after the import. If we look at context 1 data, then we can see that only 3 items out of 6 were defined in the import data, e.g. “Rel. item 1”, “Rel. item 2” and “Rel. item 3”. These items had order in Perfion accordingly: 4, 5 and 6. The other 3 items which exist in Perfion, but were not defined in import data (“Rel. item 4”, “Rel. item 5” and “Rel. item 6”) had order values in Perfion accordingly 3, 1 and 2. The items present in the import data have priority, so these items will be positioned as the first 3 items. The items which were missing in the import data will be added at the end. Moreover, those missing items will be ordered using the same order they were ordered in Perfion. The “Rel. item 5” had order 1, so it will be added as the first item after all items where in the import, e.g. the new order will be 4. Then “Rel. item 6” will be added with order 5 and finally “Rel. item 4” will be added as the last item with order 6.
Refer to “Example Using Various Order Values” to see an example of order import.
Data Validation
Related sort order importer first validates all import data and Perfion status, and only then performs the import if there are no errors.
Data referred in import data must exist in Perfion during import. If any referenced data is not present in Perfion at the time of import, or the Perfion data is not correctly set up, the import will not be performed and errors will be reported to the import log.
Import can only handle related sort order values. Related sort order import will not create any new items and will not make any new relations between items. If those items or relations are not present in Perfion, they will be detected as import errors.