### GetLocal

Category

Flow Control

Function

Retrieves an object from the cache. State is not maintained between executions of any macros containing GetLocal.

Syntax

`object, link` = GetLocal(`object, reset`);

Inputs

Name | Type | Default | Description
--- | --- | --- | ---
`object` | object | none | object to be output if nothing has been set
`reset` | flag | 0 | 0: the object cached by SetLocal (if there is one) is passed to output 1: `object` (not the cached object) is passed to output.

Outputs

Name | Type | Description
--- | --- | ---
`object` | object | retrieved object
`link` | string | link to corresponding SetLocal module

Functional Details

GetLocal works with SetLocal to place objects in and retrieve them from the cache. GetLocal differs from GetGlobal in that GetLocal and SetLocal are used when the state maintained by the Get/Set pair should be reset when a macro containing these modules is reexecuted. In contrast, GetGlobal and SetGlobal will maintain state when the macro is reexecuted. Note that for a single execution of a macro (for example, throughout the execution of an entire loop), state is of course maintained by both GetLocal and GetGlobal.

`object` | specifies the object to be output by GetLocal if nothing has been placed in the cache (e.g., as on the first execution of a visual program) or if `reset` = 1.
`reset` | causes the module to output `object`. If this parameter is set to 0 (zero), GetLocal retrieves the last object placed in the cache by SetLocal (if there is one). Otherwise, the module passes `object` to the output.

The `link` output is to be connected to the `link` input of the corresponding SetLocal module. GetLocal should always be used with SetLocal, not with SetGlobal. SetLocal must be executed on the same machine as GetLocal (i.e., it cannot be distributed to a different machine).

It is not necessary to use the First tool to provide input to the `reset` parameter of GetLocal inside a macro, since this is done automatically whenever the macro is reexecuted.

A detailed description of the behavior and use of the GetLocal, GetGlobal, SetLocal, and SetGlobal modules can be found in 4.6 , "Preserving Explicit State" in IBM Visualization Data Explorer User's Guide.

Example Visual Programs

    Accumulate.net
    Bounce.net
    SimpleGetSetLoop.net

See Also

Done, First, SetLocal, GetGlobal, SetGlobal, Reset

Chapter 4. "Data Explorer Execution Model" in IBM Visualization Data Explorer User's Guide.

[ OpenDX Home at IBM | OpenDX.org ]