CSP and HTML Tag Reference
<CSP:QUERY>
[Back] [Next]
   
Server:docs1
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

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 %ResultSet 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 %ResultSet 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 %ResultSet object. The %ResultSet 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 %ResultSet object is automatically closed at the end of the generated OnPage method.
For example, the following opens a %ResultSet object (named query) based on the ByName query within the Sample.Person 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>