Queries
Retrieve products matching a set of predefined criteria
The Queries section of the Products-area is where you create and configure product queries to e.g. retrieve All active products or All products with no Spanish translation, etc. Queries are flexible and can be used for many purposes – you can create as many personal and shared queries as you like to find products you need to look at, but some queries are also used to e.g. retrieve products to include in a dynamic workspace structure.
Queries in PIM are based on repositories – specifically a Product-index – and consist of the same basic components; a source index, some parameters and expressions, etc. We’re not going to go into details about all of these index-related subjects here – but you can read about them in the linked repositories documentation.
To create a query:
- In the Query-section of the tree use the + or context menu to create a new query
- Specify a name and a source index
- Save
The query is now created, but as it does not have any expressions it will return all products in the product index selected as a source. That’s rarely useful, so you should add expressions:
- In the tree, open the context-menu for the query and click Edit
- On the overview find the Expressions-section and click Manage
- Create a number of expressions:
- Select a field to check – you have access to all standard and custom product attributes as well as a number of generated fields
- Select a type of test value – e.g. a constant or a value passed by a parameter
- Select an operator like Contains or IsEmpty
- Save and close
The intricacies of queries and expressions are beyond the scope of this article – you can read much more about that subject in the queries documentation – but once you’ve created a set of expressions and saved you should see fewer products returned by the query. In this manner you can create personal and shared queries for a variety of purposes.
Configure Queries
From the context menu you can open the query configuration screen - this screen is used when you want to add a context for completeness purposes to the query. Once defined, the products returned by this query will show a completeness percentage in relation to the completeness rules selected and the languages included. This context is also applied when you use the query elsewhere, e.g. in dynamic workspaces.
In many cases you may also want to only add completeness languages to the query context, and then define or inherit the completeness rules to apply directly on the dynamic workspace.