Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

DataAccessor Object

 

Objects of the DataAccessor class enable scripts to perform SQL queries and LDAP searches using the Steel-Belted Radius Carrier SQL and LDAP data accessor plug-ins.

All DataAccessor methods are available to both realm selection and attribute filter scripts.

Properties

Properties

FOUND

FOUND

Purpose

The FOUND property is returned by the Execute() method when the requested data object is found.

Example

found = (da.Execute() == DataAccessor.FOUND);

NOTFOUND

NOTFOUND

Purpose

The NOTFOUND property is returned by the Execute() method when the requested data object is not found.

Example

notfound = (da.Execute() == DataAccessor.NOTFOUND);

FAILED

FAILED

Purpose

The FAILED property is returned by the Execute() method when the data request fails.

Example

failed = (da.Execute() == DataAccessor.FAILED);

PASSWORDFAILED

PASSWORDFAILED

Purpose

The PASSWORDFAILED property is returned by the Execute() method when the requested data object did not have the correct password.

Example

passwordfailed = (da.Execute() == DataAccessor.PASSWORDFAILED);

Constructor

Constructor

The data accessor name is given as an argument to the object constructor.

new DataAccessor()

new DataAccessor()

Purpose

The new DataAccessor() object instance is required to use the DataAccessor methods.

Syntax

new DataAccessor(name)

Parameters

Table 165: new DataAccessor() Parameters

Parameter

Description

name

Specifies the name of the data accessor, as configured in the .gen file.

Returns

The new DataAccessor() object reference.

Example

Methods

Methods

SetInputVariable()

SetInputVariable()

Purpose

The SetInputVariable() method is used to set a named variable in the data accessor input container.

Syntax

accessor.SetInputVariable(name, value)

Parameters

Table 166: SetInputVariable() Parameters

Parameter

Description

name

Specifies the name of the input container variable from the data accessor .gen file.

value

Specifies the string representation of the input variable value.

Returns

Nothing.

Example

SetInputVariable (“Phone-Number”, “5551212” );

GetOutputVariable()

GetOutputVariable()

Purpose

The GetOutputVariable() method is used to get a named variable from the data accessor output container.

Syntax

accessor.GetOuputVariable(name,[index])

Parameters

Table 167: GetOutputVariable() Parameters

Parameter

Description

name

Specifies the name of the output container variable from the data accessor .gen file.

index

(Optional) Specifies the index value for multivalued attributes. You can specify the value for index as part of the command, or you can use a separate variable to set the value for index.

Default value is 0.

Returns

The string representation of the output variable value.

Example

The following example illustrates a single-value attribute lookup:

var name = accessor.GetOutputVariable(“User-Name”);

The following example illustrates a multivalued attribute lookup:

var index = 2;

var address = accessor.GetOutputVariable(“Street-Address”,index);

Execute()

Execute()

Purpose

The Execute() method is used to execute the query or search using the current input container data values.

Syntax

accessor.Execute()

Parameters

Nothing.

Returns

FOUND, NOTFOUND, OR FAILED properties.

Example

found = (da.Execute() == DataAccessor.FOUND);

Clear()

Clear()

Purpose

The Clear() method is used to clear accessor input and output container values.

Syntax

accessor.Clear()

Parameters

Nothing.

Returns

Nothing.

Example