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:

Symbol Definition
Query Criteria | “(” Query “)” (“AND” | “OR”) “(” Criteria “)”
Criteria Attribute Operator Value | Attribute “IN” “(” ValueSet “)”
Attribute “[“ attribute name  “]”
Operator “=” | “” | “=” | “!=”
Value “NULL” | NonNullValue | ParameterPrompt
ValueSet NonNullValue | ValueSet “,” NonNullValue
NonNullValue “‘” literal value “‘”
ParameterPrompt “‘{” attribute name “:” prompt text “}'”
literal value The actual value of the Attribute, for example an actual invoice number.
attribute name The actual name of the Attribute as defined in IQadministrator
prompt text The text that appears on the client search screen, for example, Enter an invoice number.

 

Query Syntax Example Result
[Employee Number] = ‘{? Employee Number: Enter an Employee Number}’ Prompts the user to enter an employee number and searches across all Document Types for that value
[DocumentType] IN (‘W-4’, ‘Form I-9’) AND
([Employee Number] = ‘{? Employee Number: Enter an Employee Number}’)
Prompts the user to enter an employee number and searches only the W-4 and Form I-9 document types for that value