aspRDBs ASP Javascript Procedure

Simplified server side Javascript procedure that inserts the value of a Parameter Database entry into an ASP file at the place in the file where the procedure is invoked.

<% aspRDBs(dataid, unit); %>

Prerequisites

Must be contained within a file with a .ASP (Active Server Page) extension.

Parameters

dataid

A required numeric value that specifies an integer identification code for the Database Parameter to be accessed.  For example, the DB Parameter for reading the "Controller name" is 109.

unit

A required numeric value that specifies an integer unit number for the parameter to be accessed.  For many parameters, e.g. the Controller, only a single unit exists.  For parameters that refer to devices with multiple possible units, e.g. multiple robots driven by a single controller, unit ranges from 1 to n. 

As a special case, if this parameter is set to -1, the unit number is extracted from the "Default webserver structure index" (DataID 423) parameter.  This permits a single web page to display the information for different units (e.g. robots) depending upon the setting of DataID 423.

URL Query String Parameters

None

Remarks

When this Javascript procedure is encountered in an ASP file, the web server accesses the specified Parameter Database entry and inserts its value into the ASP file at the point where the procedure was encountered in place of the procedure call.  This procedure and aspRDB are the primary methods for displaying the values of PDB entries in a web page.  The value of the PDB entry is substituted into the web page at the point where this procedure is encountered thus dynamically altering the contents of the web page.

This is a simplified version of aspRDB where the second unit specification is set to zero, all array values out written for array PDB values and numbers are formatted in the default fashion.

An unlimited number of these procedure calls can be contained in an ASP file although each call does consume a modest amount of CPU time.

This procedure can access all types of Database values: strings, integers, real numbers, etc.

Examples

The following is a minimal ASP sample file that illustrates how to dynamically retrieve Parameter Database values.  Save this sequence in a file as /flash/appweb/test.asp.

<html>
<body>
<p>
IP address: <% aspRDBs(420,1); %><br>
Jt set points: <% aspRDBs(3501,1); %><br>
Power enabled: <% aspRDBs(241,1); %><br>
</p>
</body>
</html>

Directly display this file by specifying its address in a browser. The following is an example of what the page will look like, although your specific data will be different.

IP address: 192.168.0.1
Jt set points: 0, 2.59200000576674, 0, 0
Power enabled: 1

See Also

Web Dictionary Summary | aspRDB | /wrtpdb