The Reality Object

A Reality object is used for executing a subroutine in the Reality Operating System. In order to use this object you must have a working Reality Operating System. 

From Active Web, the Reality Interface is compatible with Reality 9.0 and upwards and now makes use of the RBSRVR interface.  You should ensure that the user you connect to Reality with has sufficient security privileges to execute Remote Basic routines.

Reality objects are of class Reality.

Reality Object Properties

Property

Description

error

An error message If an error has occurred. If no error has occurred then it will be null. The error messages are explained below:

connect failure - A connection to the Reality environment could not be established.

While accessing the Reality environment the operating system can generate various error messages.

prototype

A null reference. The Reality object does not have a prototype and cannot be given one.

Reality Object Functions

The Reality object has no predefined functions but it makes all the subroutines in the Reality environment identified by the constructor arguments available as functions.

All Reality object functions return a boolean that will be true if the subroutine was executed successfully. If there was an error the function will return false and the error property will be set.

Using the Reality Object

Creating a Reality object actually creates a session to the Reality environment. Then calling a function will use the session to do a remote subroutine call in the Reality environment.

For example assuming there is a subroutine on a system called "ADD" which takes two parameters adds them together and puts the result in the second parameter, the script code could look something like this:

myReality = new Reality(“host”, “dbase”, “user,password”, “account,password”);

p1 = 1;

p2 = 3;

if(!myReality.ADD(p1, p2)){

  writeln(myReality.error);

}

else {

  writeln(“The answer is “+p2);

}

The call to the ADD function returns a boolean value which is true if there were no errors or false if there was an error. If there has been an error then the error property will contain a string describing the error that occurred.

Note that there is no need to create many Reality objects if all of the required Reality subroutines are in the same dbase, user and password.


The Reality Constructor

Using the new Operator with the Reality Constructor

The Reality constructor is used to create new Reality objects.

var myReality = new Reality(host, dbase, user, account);

A new Reality object is created using the arguments supplied.

host - The DNS name or IP address of the Reality machine.
dbase - The name of the Reality database.
user - The user ID used to connect to the Reality database, with an optional comma separated password.
account - The account used to connect to the Reality database, with an optional comma separated password.

The Reality object has no prototype chain.

Calling the Reality Constructor as a Function

When the constructor is run as a function without the new operator it has exactly the same behaviour as using the new operator.

Reality Constructor Properties

Constructor properties are read only (they can not be changed or deleted) and it is not possible to add new properties to the Constructor.

Property

Description

prototype

A reference to the Object Prototype. This property does not enumerate and cannot be changed or deleted. This prototype is not used for Reality objects as they do not have a prototype. It is here for future use.

Reality Constructor Functions

Function

Description

fromArray(array)

Return a string with Reality 'attributes', 'values' and 'subvalues' converted from the argument array. This function converts the three level argument array into a Reality structure using 'attributes' for level zero, 'values' for level one and 'subvalues' for level two.

toArray(string)

Return an array that reflects the structure of the argument string. This function converts the string value of the argument into an array structure based on Reality 'attribute', 'value' and 'subvalue' marks in the string.

Comment on this topic

Topic ID: 150090