TEMPORARY_DB

Concept Link IconSee also Concept Link IconExample

Activation, creation and deletion of temporary variables.

WebVue support - Yes.

For further information, see the Variables Tree book in the Application Explorer Help.

Starting with version 12 and the introduction of HMI variables, temporary variables created with this instruction are obsolete. The TEMPORARY_DB instruction is only kept for compatibility with existing projects and should not be used in new projects. When migrating a project, we recommend you to replace the use of temporary variables by HMI variables. To make it easier, you can create HMI variables by script using the instruction VARIABLE.

Mode

Mnemonic

Syntax

0 OFF 1
1 ON 1
2 ADDBIT 2
3 ADDREG 3
4 ADDTXT 4

Syntax 1

IntVal = TEMPORARY_DB(Mode);

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

0

OFF

The automatic creation of temporary variables is disabled.

1

ON

The automatic creation of temporary variables is enabled. Any variables referred to in an animation that do not exist in the Variables Tree are automatically created at the HMI level, not in the Variables Tree.

 

 

Return: Always 1

Syntax 2

IntVal = TEMPORARY_DB(Mode, VarName, Title_1, Title_2);

Argument

Meaning

VarName

The name for the temporary variable. Type STR

Title_1

The title for the temporary variable in the primary language. Type STR

Title_2

The title for the temporary variable in the alternative language. Type STR

Return type: INTEGER.

Execution

Mode

Mnemonic

Action

2

ADDBIT

A temporary bit variable is created using the supplied attributes.

Return: 1 if successful, else 0 (if the variable already exists, syntax error...).

Syntax 3

IntVal = TEMPORARY_DB(Mode, VarName, Title_1, Title_2, Min, Max, Format, Units);

Return type: INTEGER.

Argument

Meaning

VarName

The name for the temporary variable. Type STR.

Title_1

The title for the temporary variable in the primary language. Type STR.

Min

The minimum value of the range of the register. Any numeric type.

Max

The maximum value of the range of the register. Any numeric type.

Format

The display format for the register, for example ###.##. Type STR.

Units

The unit text for the register, for example "DegC". Type STR.

Execution

Mode

Mnemonic

Action

3

ADDREG

A temporary register variable is created using the supplied attributes.

Return: 1 if successful, else 0 if the variable already exists, syntax error etc.

Syntax 4

IntVal = TEMPORARY_DB(Mode, VarName, Title_1, Title_2);

Return type: INTEGER.

Argument

Meaning

VarName

The name for the temporary variable. Type STR

Title_1

The title for the temporary variable in the primary language. Type STR

Title_2

The title for the temporary variable in the alternative language. Type STR

Execution

Mode

Mnemonic

Action

4

ADDTXT

A temporary text variable is created using the supplied attributes.

Return: 1 if successful, else 0 if the variable already exists, syntax error etc.

Example

DIM ConstVarName As Str;
DIM VarName As Str;
DIM Index As Integer;
ConstVarName = "TempBit"

'Create 100 bit variables: TempBit0 to TempBit99
For(Index = 0; Index < 100; Index ++)
VarName = AddString(ConstVarName, TOC(Index));
Temporary_DB("ADDBIT", VarName, "", "");
Next

For a further example, select the Example link above.