Skip to main content

CSP Tags: <csp:query>

Use the <csp:query> tag to execute a class query defined in a CSP class. Use <csp:while> to iterate through the %ResultSetOpens in a new tab object returned by the query.

Add the code shown below to MySamplePage.CSP between <body> and </body>. The code uses <csp:query> to execute the ByContactType class query defined in CSPTutorial.Contact. It uses <csp:while> to iterate through the %ResultSetOpens in a new tab object returned by the query. You can remove all other code from between <body> and </body>.


<body>
<csp:query name="query" classname="CSPTutorial.Contact" 
queryname="ByContactType" P1="Business">
<csp:while condition="query.Next()">
<p>#(query.Data("Name"))#</p>
</csp:while>
</body>

Click View —> Web Page to view MySamplePage.CSP in a Web browser.

generated description: querytag20142

Note:

Executing this code requires that you install and populate CSPTutorial.Contact in the USER namespace. PartIStarter.xml contains the class definition. For instructions on installing and populating, read Installing Tutorial Files.

To learn more about class queries, read Class Queries in Using Caché Objects.

FeedbackOpens in a new tab