# Local Variables

Local variables are internal variables that are only accessible within a screen, content, or its scripts where the local variable is set up. Since local variables are only available within the screen/content, it is convenient for temporary data.

Hide Show

1. Maximum Number of Local Variables
2. Naming and Data Types
3. Data Binding
4. Copying Local Variables
5. Copying Objects Associated with Local Variables
6. Others

## Maximum Number of Local Variables

You can configure up to 300 local variables per screen/content in the screen editing software. When a screen has a Content Display, and the total number of local variables in the screen and the local variables in the contents associated with the Content Display exceeds 3600, an error occurs.

The maximum number of local variables varies depending on the display model. The maximum number of local variables per project is not included in the maximum number of global variables per project.

For information about the maximum number of local variables for each display model, refer to the following.

Supported Model/Feature List

The maximum number of local variables that can be loaded in the screens that are drawn at run time is 3600. Drawing stops if the limit of 3600 local variables is exceeded and a system error displays.

Note:

- When using scroll gestures to change the screen/content for a Slide Content Display or slide navigation, local variables set in the previous and next screens/content that are not currently displayed, are also included in the calculation towards the upper limit.

- Even if an object is not visible at run time due to its current [Visibility] setting, local variables set to the object are also included in the calculation towards the upper limit.

- If you indirectly specify the [Content ID] of a Content Display object or a Slide Content Display object, the screen editing software cannot count the local variables for that content. Therefore, even if there is no error in the screen editing software, the local variable limit may be exceeded at run time and the content may not display. If that happens, a system error will display.

## Naming and Data Types

Local Variable names must be unique within a screen/content. For information about the naming convention for local variable names, refer to the following.

Naming Conventions

The data types supported by local variables are the same as basic variables except for WSTRING. Data types for user data type variables are also not supported. For information about data types, refer to the following.

Data Types

You cannot use a global variable as the element number for local array variables.

## Data Binding

You can associate an object’s property with a local variable. Since local variables are available only within a screen/content, it is convenient for temporary data. When making associations with a local variable, the prefix “$Local” is added. Example: $Local.Var1.Value

Since local variables cannot be used for global features such as alarm, data logging, USB barcode reader, and OPC UA, global features must use global variables. For information about data binding, refer to the following.

Data Binding

## Copying Local Variables

You can copy global variables to local variables and vice versa.

When copying global variables to local variables, the relevant properties are copied. When copying local variables to global variables, default values are set in properties that are not available in local variables.

## Copying Objects Associated with Local Variables

You can copy an object associated with a local variable to another screen.

When the destination screen does not have a local variable with the same name, the [Alert] dialog box will display.

Select the [Paste] button to paste the object.

Select [Paste with Binding(s)] to paste the object and its associated local variables.

When the destination screen has a local variable of the same name, the object is pasted, and the local variable in the destination screen is associated with the copied object. If the data type of the local variable does not match, an error occurs at build time.

## Others

You cannot read or write local variables using the OPC UA server or the Web API / WebSocket.