OScript API/Built-in Package Index

Class: Global

OScript maintains two distinct name spaces for global values: Application and Thread.

Application globals are local to each "kernel" thread running an OScript Virtual Machine (VM) within the Livelink process. Application globals cannot be accessed outside of their kernel thread, but can be shared within threads running in its OScript VM.

Thread globals are local to a thread within an OScript Virtual Machine, of which there are likely many since there is one for each request being processed. Like Application globals, Thread globals are not sharable between OScript VMs, but unlike Application globals they are not sharable between request threads in the VM.

Within the builder environment, only one OScript VM will exist, while in the server environment, more than one may exist. Because of this care should be taken to avoid storing information within globals whose contents may change and are relied upon between different requests.

The functions in this package allow for manipulation of Application and Thread global values. In addition OScript allows globals to be directly referenced by specifying the name with either a leading $$, for Thread globals, or a $ for Application globals.

Class Methods

Application( [String name], [Dynamic value] )

Lists, gets, or sets Application (hardware thread) globals.

Thread( [String name], [Dynamic value] )

Lists, gets, or sets Request globals.

Class Methods

Application

Dynamic Application( [String name],
                     [Dynamic value] )

Lists, gets or sets Application globals. When no arguments are specified a List containing the names of all Application globals is returned. When just the name argument is specified the current value of the specified Application global is returned. When both name and value are specified the Application global is set to the specified value.

When no arguments are specified a List containing the names of all Application globals is returned. When just the name argument is specified the current value of the specified Application global is returned. When both name and value are specified the new value is returned.

Parameters

name

If specified, the name of the global to get or set.

value

If specified, the value to which the specified global will be set.

Returns:

When no arguments are specified a List containing the names of all Application globals is returned. When just the name argument is specified the current value of the specified Application global is returned. When both name and value are specified the new value is returned.

Example

Here is a short example which will lists all the Application globals and their current values:

String  s

for s in Global.Application()
    Echo( s, " = ", Global.Application( s ) )
end

Thread

Dynamic Thread( [String name],
                [Dynamic value] )

Lists, gets or sets Thread globals. When no arguments are specified a List containing the names of all Thread globals is returned. When just the name argument is specified the current value of the specified the value of the Thread global is returned. When both name and value are specified the Thread global is set to the specified value.

Parameters

name

If specified, the name of the global to get or set.

value

If specified, the value to which the specified global should be set.

Returns:

When no arguments are specified a List containing the names of all Thread globals is returned. When just the name argument is specified the current value of the specified Thread global is returned. When both name and value are specified the new value for the Thread global is returned.

 Copyright © 2022 OpenText Corporation. All rights reserved.