aspRDB ASP Javascript Procedure

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.

<% aspRDB(dataid, unit, unit2, array_index, o_format); %>

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 Database 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 unit 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.

unit2

A required numeric value that specifies an integer sub unit number for the Database Parameter to be accessed. The use of the sub unit number is not very common and unit2 is normally set to 0 or 1.

array_index

A required numeric value that specifies an integer array index for parameters that have multiple values. For example, for a robot with multiple axes, the “joint maximum soft stop limits” (dataid 16077) is an array with one value for each joint. If array_index is set to 0, all of the array elements of the parameter are returned separated by commas.  If the value is from 1 to n, a single value is returned.

o_format

A required numeric value that specifies special output formatting for numeric Database Parameters.  This value is interpreted as follows:

o_format Description

<0

The number is truncated to -o_format fractional digits

0

No special formatting

1

Output "Yes" or "No" based upon DB value

2

Output "On" or "Off" based upon DB value

3

Output as 8 hexadecimal characters with leading "0"'s

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 aspRDBs 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.

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.  If the Database entry has an array of values and array_index is 0, all of the array elements will be written, separated by comma characters.

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: <% aspRDB(420,1,0,0,0); %><br>
Jt2 set point: <% aspRDB(3501,1,0,2,-2); %><br>
Power enabled: <% aspRDB(241,1,0,0,2); %><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
Jt2 set point: 2.59
Power enabled: On

See Also

Web Dictionary Summary | aspRDBs  | /wrtpdb