Skip to main content

<CSP:QUERY>

Define and execute a predefined class query

Synopsis

<CSP:QUERY>

Attributes

General Attributes

Attribute Description Value
CLASSNAME Name of the class containing the query. A valid class name (including package name).
MODE Runtime mode of the query. “LOGICAL”, “ODBC”, “DISPLAY”, or “SYSTEM”.
NAME Name of local variable used to refer to the %ResultSetOpens in a new tab object created for this query. A valid variable name.
P1 Value of the first query parameter. A string.
P2 Value of the second query parameter. A string.
P3 Value of the third query parameter. A string.
P4 Value of the fourth query parameter. A string.
QUERYNAME Name of the class query. A valid query name.

Description

The CSP:QUERY tag creates a %ResultSetOpens in a new tab object based on a query defined within a Caché class. This tag defines a server-side variable, whose name is specified by the tag's name attribute, that refers to a %ResultSetOpens in a new tab object. The %ResultSetOpens in a new tab object is automatically executed (by calling its Execute method using the parameter values given by the various Pn attributes of the tag) and is ready for use within the page. The %ResultSetOpens in a new tab object is automatically closed at the end of the generated OnPage method.

For example, the following opens a %ResultSetOpens in a new tab object (named query) based on the ByName query within the Sample.PersonOpens in a new tab class and then displays the results of the query in an HTML unordered list (<UL>):

<CSP:QUERY NAME="query" CLASSNAME="Sample.Person" QUERYNAME="ByName">
<UL>
<CSP:WHILE CONDITION="query.Next()">
<LI>#(query.Get("Name"))#
</CSP:WHILE>
</UL>
FeedbackOpens in a new tab