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

Server and client script tag
Synopsis
<SCRIPT>...</SCRIPT>
Attributes
General Attributes
Attribute Description Value
LANGUAGE Script language “cache”, “sql”, “esql”, or “basic”.
Caché or Basic Attributes
Attribute Description Value
RUNAT When to run Caché inline script. “server” or “compiler”.
METHOD Name of Caché method being defined. String.
PROCEDUREBLOCK If METHOD is specified, indicates whether this method can use Caché ObjectScript procedureblocks. (Ignored for a Basic script.)
1 – if script can use procedureblocks.
0 — if script cannot use procedureblocks. Default.
ARGUMENTS If METHOD is specified, the argument list for the method. Comma-separated list of arguments in the form P1=value, P2=value,.... Pn=value
RETURNTYPE If METHOD is specified, the data type of the value returned by the method. String.
SQL Attributes
Attribute Description Value
MODE Runtime mode of the query. “LOGICAL”, “ODBC”, “DISPLAY”, or “SYSTEM”.
NAME For dynamic SQL, the name of local variable to hold reference to %ResultSet object. String.
P1 ... Pn For dynamic SQL, value query parameters. Comma-separated strings in the form P1, P2, ... Pn.
Description
The SCRIPT tag is used to define server-side Caché scripts, server-side SQL scripts, or client side JavaScript scripts. The runat or method attribute is used with Caché. The name or cursor attributes are used with SQL. No attributes are used with ESQL. The remaining attributes are used with Javascript.
Note:
Note that only Javascript scripts run on the client. Caché scripts and SQL scripts run on the server.
Using Embedded SQL
The <SCRIPT LANGUAGE=ESQL> tag inserts the contents of the tag as embedded SQL in the class generated by the CSP page.
<SCRIPT LANGUAGE=ESQL>...</SCRIPT>
Specifying an SQL Query
The <SCRIPT LANGUAGE=SQL> tag creates a %ResultSet object based on an SQL query defined within the inner text of this tag. The query may contain parameters (values substituted at runtime) within its WHERE clause. These parameters are specified using the ? character. 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 prepared and executed (by calling its Execute method using the parameter values given by the Pn attributes of the tag) and is ready for use within the page. The following example creates an unordered list by running a query:
<SCRIPT LANGUAGE='SQL' NAME='query' P1='A'>
SELECT ID,Name FROM IscPerson 
WHERE Name %STARTSWITH ? Order By Name
</SCRIPT>

<ul>
<csp:WHILE>
    <li>#(query.Get("Name"))#
</csp:WHILE>
</ul>