PilotScript Global Property List Functions

The following global property list functions are available for PilotScript components.

The Global Property List functions operate on the global property list and manipulate properties based on their name (text strings), not their value. Note that some global properties are predefined for all protocols and are read-only. Examples are the user name and the server name.

Global Property List Function Name/Prototype Description Example

GlobalProperty

Property GlobalProperty(String name)
Returns a reference to the global property with the given name. You can assign to the reference or access its value.
#name := 'cl_' . @counter;
GlobalProperty(#name) := clusterID;

Assigns a data record value (clusterID) to a global property constructed by prefixing cl_ to a global counter value.

IthGlobalProperty

Property IthGlobalProperty(Number propnum)
Returns a reference to the global property with the given position number. The position numbers are arbitrary and carry no guarantees. This is only useful for looping over all global properties.
FOR #i in 1 .. NumGlobalProperties(

LOOP

   IthGlobalProperty(#i) += 5;

END LOOP;

Adds 5 to the value of every global property.

IthGlobalPropertyName

String IthGlobalPropertyName(Number propnum)
Returns the name of the ith global property on the global property list.
#NumGlobals := NumGlobalProperties();
FOR #i in 1 .. #NumGlobals

LOOP

   Append(#GlobalNames, IthGlobalPropertyName(i));

END LOOP; 

Creates a local property GlobalNames (contains a list of all the global properties); gets the number of globals using NumGlobalProperties, then loops and collects the names.

This example uses the component-local properties #i and #GlobalNames rather than the globals @i and @GlobalNames to preserve the global protocol state during looping.

NumGlobalProperties

Number NumGlobalProperties()
Returns the number of global properties on the global property list.
#NumGlobals := NumGlobalProperties();

FOR #i in 1 .. #NumGlobals

LOOP

   Append(#GlobalNames, IthGlobalPropertyName(#i));

END LOOP; 

Creates a local property GlobalNames that contains a list of all the global properties, gets the number of globals using NumGlobalProperties, then loops and collects the names.

This example uses the component-local properties #i and #GlobalNames rather than the globals @i and @GlobalNames to preserve the global protocol state during looping.

RemoveGlobal

None RemoveGlobal(String var[,...])
Takes one or more global property names and removes them from the global property list.
RemoveGlobal('a', 'b', 'count');

Removes the properties A, B, and count from the global property list.

RenameGlobal

None RenameGlobal(String varnameold, String varnamenew)
Changes the name on the global property list of varnameold to varnamenew .
A := 'This value is assigned to B';

RenameGlobal('A', 'B');

The property A is no longer on the global property list. It is renamed to B and B has a value of "This value is assigned to B".

RGlobalPropertyNames

StringArray RGlobalPropertyNames(String regex)
Returns an array of strings with the names of all the properties on the global property list that match the supplied regular expression.
#gprops := RGlobalPropertyNames('^A.*');

FOR #i in 1 .. numvalues(#gprops)

LOOP

   RenameGlobal(#gprops[#i], #gprops[#i] . '_new');

END LOOP;

Loops over all global properties that start with A (the regular expression ^A.*) and renames them to end with "_new". To rename all of the global properties in the @props array, loop through the array and address each element of the array.