NameValue

Description

Sets or returns the value associated with a given variable name.

Use this property to get and set the values for session-wide variables. Because this property consists of an array of values, you must specify the name of the variable you are interested in. If you set the value of a variable that does not exist, it is created with the specified value assigned to it. If you try to get the value of a variable that does not exist, an empty Variant is returned.

DevOps Plan supports the use of session-wide variables for storing information. Once created, you can access session-wide variables through the current Session object at any time and from functions or subroutines, including hook routines, that have access to the Session object. When the current session ends, either because the user logged out or you deleted the Session object, all of the variables associated with that Session object are deleted. A Session-wide variable is accessed through the NameValue property (GetNameValue and SetNameValue methods). In addition, the HasValue method can be used to check whether a variable exists.

Syntax

Perl


$session->GetNameValue(variable_name);
$session->SetNameValue(variable_name, newValue); 
Identifier
Description
session
The Session object that represents the current database-access session.
variable_name
A String containing the name of the variable to get or set.
newValue
A String specifying the new value for the variable.
Return value
A String containing the value for the variable.

Example

Perl


$sessionObj = $entity->GetSession();

if ($sessionObj->HasValue("test")) {

# Get the old value of the session variable "test" 

$testValue = $sessionObj->GetNameValue("test");



# Set the new value of "test" 

$sessionObj->SetNameValue("test","bar");