:PUT_VAR

Use the :PUT_VAR statement to store one or more values in a static VARA object. Define parameters for the statement to assign values to a particular line and specific columns in the VARA object.

Syntax

:PUT[_VAR]VARA object,[Key], Value [,Value[,Value[,Value[,Value]]]]

Parameters

Notes:

Important!

The Data Type of the VARA object has an impact on the values that you can specify with the :PUT_VAR statement. For more information, see User-Defined VARA Objects.

When you store a value in a VARA object that has a Timestamp data type, use one of the following formats:

For time, date and number data types, format your value according to the format defined for the VARA object (Result Format on the Attributes page).

Important! For number data types, redundant decimal places are truncated when you store a number that has more decimal places than the result format for the VARA object allows.

For more information, see Script Variable Data Types.

Examples

The following example writes values to all 5 columns in a VARA object:

 :PUT_VAR VARA.TEST, "KEY1", "Value1", "Value2", "Value3", "Value4", "Value5"

In the following example, the SYS_DATE and SYS_TIME functions retrieve the current date and time. The values are assigned to script variables. The :PUT_VAR statement writes the values in a VARA object called BOOKING.DATE.

:SET &DATE# = SYS_DATE("YYYY-MM-DD")
:
SET &TIME# = SYS_TIME("HH:MM:SS")
:
PUT_VAR BOOKING.DATE, , "&DATE# &TIME#"

In the following example, assume that the VARA object called ATTRIBUTES is configured with a Freely selected scope. In this case, you must define the Key (the "CurrentPriority" below) in the parameters:

:SET &PRIO# = GET_ATT("UC4_PRIORITY")
:
PUT_VAR ATTRIBUTES, "CurrentPriority", &PRIO#

The following example retrieves several values (the RunID, name, and object type of a task and its parent). The single :PUT_VAR statement writes the retrieved values to separate columns in a VARA object called OBJECT_STAT.

:SET &PNAME# = SYS_ACT_PARENT_NAME()
:SET &PNR#SYS_ACT_PARENT_NR()
:SET &PTYPE# = SYS_ACT_PARENT_TYPE()
:SET &NAME#SYS_ACT_ME_NAME()
:SET &NR#SYS _ACT_ME_NR()
:SET &TYPE#SYS_ACT_ME_TYPE()

:PUT_VAR OBJECT_STAT, "&NR#", "object name: &NAME#", "object type: &TYPE#", "parent name: &PNAME#", "parent RunID: &PNR#", "parent object type: &PTYPE#"

The following example writes a single value to an XML VARA object, as that object type only contains one value field:

:PUT_VAR VARA.XML, "KEY1", "<Value1>this is a test</value1>"

See also:

seealso

GET_SCRIPT_VAR

seealso1

Variables and VARA Objects

Script Elements for Variables and VARA Objects