Query definitions can use literal values for entity attributes in query text, or they can use bind variables whose values are provided at runtime.In the Query.create() function, use a dollar sign ($) to indicate a bind variable in the query text. (See $min in the example below.)The values for all bind variables must be supplied to a statement when it executes. Set the value of a bind variable, using the Query.Statement.setVar() function, from the CEP Query Functions catalog, as shown next.
When you use the Query.Statement.setVar() function, functions must be called in the following order:The following example shows how a bind variable in a query definition is set as the value of an event property by the Query.Statement.setVar() function. The value could be defined as a literal value as desired, or in some other way, depending on context and need.
Query.create("report927", "select agent_name, total_sales, zipcode from /Concepts/Sales where total_sales >= $min");
Where evt.min_total_sales is an event property of a numeric type.You can use Query.Statement.clearVars() to clear all bind variable values associated with the named statement.
Copyright © TIBCO Software Inc. All Rights Reserved.