Query Definition Creation

A query definition is a Java runtime object (similar to a factory class).

Creating a query definition is a separate step from opening and executing a query statement. Creating a query definition is the most expensive step in the process of making the query available for execution. Therefore it is often best done at engine startup. The syntax of the function is:

Query.create(String QueryDefinitionName, String QueryText);

The QueryDefinitionName is used in other functions to identify the query definition. The query text contains the select statement.

For example,

Query.create("report","select zipcode, total_sales, agent_name from /Concepts/Sales where total_sales > $min");

Where $min is a bind variable whose value is provided at runtime.

If a query statement based on this definition is executed and returns a result set, the result set columns would be, zipcode, total_sales, and agent_name, with rows of entity values that match the condition specified at the time the query was executed.