Perfion Query Reference

Overview

The Perfion Query syntax and all its possibilities are described in the following sections. The Perfion Query can be defined in either XML or JSON format. All examples are shown in each version.

A simple example

Below is a very simple example of what a Perfion Query could look like. The query is defined to return data for the 3 features ItemNumber, Image and Description in the English language for Products that have value 1600 in PowerW.

XML:

<Query> <Select languages='EN'> <Feature id='ItemNumber' /> <Feature id='Image' /> <Feature id='Description' /> </Select> <From id ='Product'/> <Where> <Clause id='PowerW' operator='=' value='1600' /> </Where> </Query>

JSON:

{ "Query": { "Select": { "languages": "EN", "Features": [ { "id": "ItemNumber" }, { "id": "Image" }, { "id": "Description" }, ] }, "From": [ { "id": "Product" } ], "Where": { "Clauses": [ { "Clause": { "id": "PowerW", "operator": "=", "value": "1600" } } ] } } }

Below is an example of what the results from the above query could look like:

XML:

<Data totalExecutionTime="00:00:00.1105121"> <Features> <Image id="105" language="EN" caption="Image" group="All" dataType="Image" /> <Description id="148" language="EN" caption="Description" group="All" dataType="Text" /> <Product id="100" language="EN" caption="Product" group="All" dataType="String" /> </Features> <Product id="853" parentId="0" brand="Normal" order="0" > <Value seq="0" modifiedDate="2016-07-12T11:01:22.93">TE717209RW</Value> <Image seq="0" modifiedDate="2019-11-27T09:09:56.437" string="MCSA00992759_SE_K_12_KV7_EQ7_TE717209RW_picture_KF1_coffeemachine_ENG_230215_def_(48).jpg.jpg" fileSize="18967" fileModifiedDate="2019-11-27T09:09:50.123" width="300" height="300" widthDpi="48" heightDpi="48">5fd1e0be-56bd-407f-bce8-6e6d35f1e792</Image> <Description language="EN" seq="0" modifiedDate="2017-11-23T13:48:44.45">Siemens TE717209RW is a beautiful piano black fully automatic espresso machine from Siemens EQ7 series. With just a tap you make cappuccino, latte, espresso or coffee. This model has the smart and practical "My Coffee" function so you can configure the relationship between milk and espresso in your drink - you could choose up to 80% coffee, so you have extra power and heat your milk drink! The grinder automatically adjusts itself to the coffee blend you use. And the individual programming ensures that up to 6 people can have their own coffee profile, where each button is programmed after the personal wishes.</Description> </Product> <Product id="858" parentId="0" brand="Normal" order="0" createdDate="2016-07-12T11:15:10.52" modifiedDate="2020-04-21T14:59:11.317"> <Value seq="0" modifiedDate="2016-07-12T11:15:18.887">TE806201RW</Value> <Image seq="0" modifiedDate="2019-11-27T09:09:56.437" string="MCSA01088244_SE_K_12_KV8_EQ8_TE806201RW_picture_KF1_machine_ENG_120615_def_(48).jpg.jpg" fileSize="36135" fileModifiedDate="2019-11-27T09:09:50.17" width="452" height="480" widthDpi="48" heightDpi="48">004ede8a-592a-4466-90ae-f5f97aa117dc</Image> <Description language="EN" seq="0" modifiedDate="2016-07-12T11:50:54.053">EQ8 series espresso machines in a class by itself, with a beautiful stainless steel design and an intelligent heating system: sensoFlow-ensuring system constant brewing temperature and thus guarantees maximum enjoyment espresso every time. Siemens EQ8 also the smart aroma double shot mode makes extra strong coffee less bitter because the machine grinds and brews twice with 19 bar. Furthermore ensures EQ8 an exclusive convenience through OneTouch Feature creamCleaner, cup warmer, lighting and insulated milk container.</Description> </Product> </Data>

JSON:

The result always starts with the Metadata about the returned features followed by all the actual data

Result Metadata

The first part of the result always contains a section called <Features>, that contains all the metadata about the returned features, such as:

id

The unique ID of the feature.

In queries both the feature name and ID can be used.

Name

The unique Name of the feature

In queries both the feature name and ID can be used.

Language

Indicates the language of the values of the other attributes in the Xml-element.

Caption

The caption to precede the value on e.g. a web page, in a catalog or other output.

captionAlternative

An alternative caption.

Unit

The unit of the value of the feature.

Abbr

The abbreviation (could be used instead of the caption in some situations).

Group

The Information Group the feature belongs to.

groupOrder

The Order of the Information Group as they are defined in Perfion

viewGroup

The View Group the feature belongs to (if defined in Perfion)

viewGroupOrder

The Order of the View Group as they are defined in Perfion

dataType

The Perfion DataType of the feature (string, number, date, text, image, file, query, table).

viewOrder

The Order of appearance of the features.

Important: This is a first seen order of appearance. Each item in the result-set may have a different viewOrder defined in Perfion. The viewOrder at this level is set by inspecting each item until all columns have an order.

This viewOrder is relevant when several Items must be shown together on a list.

Form

A value indicating the form/nature of the feature, which can be either of: ‘Simple’: A simple feature containing only its own base values.

‘Complex’: The feature is extended with a configuration of additional features (e.g. a Product with many features, or a Designer with additional features).

Result Data

All the rest of the elements in the Xml contains the actual data. In the above example the enclosing elements are named <Product> since the returned items are of the feature type Product, as specified by the <From> element in the Perfion Query.

The enclosing <Product> Item elements always contain the following attributes:

id

The unique ID of the item.

parentId

The ID of the parent Item (when in a hierarchy). 0 if it has no parent.

Brand

The brand of the Item (can be either: Virtual, Normal, CatalogRoot or Brand).

Order

The Order of the Item as defined on the Item itself for its own purpose (e.g. when ordering the Sections on the left side or defining a special order of Items in a Lookup for their own purpose). For features that do not allow ‘Custom Ordering’ the Order will always be 0.

childCount

The number of child items that have this Item as their parent.

Optional: Only included with Select option ‘IncludeChildCount’ specified.

The feature value elements contained within the <Product> elements may contain the following attributes:

id

The unique ID of the item. For features defined as ‘Selectable’ (i.e. Lookup values).

Language

The language of the value of the Xml-element (for features defined as ‘Localizable’.

Seq

The sequence of the values, for features defined to ‘Allow Multiple’ and ‘Sortable’ values. The sequence is 0 for all other feature values.

relatedOrder

This order appears on a feature value element when the specific feature in its definition includes ‘Sortable Related Items’. The order indicates how the enclosing <Product> Item is ordered in relation to the feature (e.g. the order of a Product Item within a certain Section).

viewOrder

The order in which the features for an Item should appear (as defined in the Item Configuration where features can be ordered individually for different Categories or groupings of Products or Items).

Features included explicitly by the Query are ordered as defined in the Query, followed by all other features according to their order as defined by the feature Configuration.

Optional: Only included with Select option ‘IncludeFeatureViewOrder’ specified.

Furthermore, for Image and File features the following attributes are used:

string

Used to hold the filename of the image or file.

fileSize

The file size in bytes.

fileModifiedDate

The date when the file was last modified.

The Boolean data type returns "True" and "False" as values. For the two-state mode, it only returns "True" since the false is represented as Null in the system.