What is the syntax to create a saved query?

Saved Queries use the Parameterized ImageQuest Query Language (PIQQL), pronounced Pickle, developed by Informa Software. The PIQQL syntax used to execute queries is similar in form to Transact-SQL. Specifically, it takes on the same basic structure as the WHERE clause of a Transact-SQL query. However, PIQQL is not designed to be a fully-featured data querying language; its purpose is to mimic the search capabilities provided by the IQ end-user applications. This means that PIQQL does not support certain features of a native database query language. In particular, PIQQL does not support nested queries, Attribute to Attribute comparisons, or embedded expressions.

In practice, the PIQQL query is simply a string of comparisons of the form [Attribute] = ‘Value’, which can be optionally connected by the boolean AND and OR operators. Parenthesis are optional, but can be used around any part of an PIQQL query that would itself be a valid standalone query, in order to enforce proper grouping of the boolean operations. Literal values that are numeric constants do not require the enclosing quotation marks, but they are always valid. (For non-text Attributes, you must ensure that the literal value can be converted to the proper type, or the query parser will generate an exception.) The one exception to this rule occurs with sets of numeric values within a ValueSet; the PIQQL parser currently rejects a ValueSet for an IN statement if the Values are not contained within quotations.

A color coded definition of the PIQQL query syntax and query examples are shown below: