CSP and HTML Tag Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

Define and execute a predefined class query
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.
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">
<CSP:WHILE CONDITION="query.Next()">