:PUT_READ_BUFFER, :PUT_PROMPT_BUFFER
Script Statement: Puts the name and content of a script variable to the input buffer
Syntax
:PUT_READ_BUF[FER] Variable Name = Content
:PUT_PROMPT_BUF[FER] Variable Name = Content
Syntax |
Description/Format |
---|---|
Variable Name |
Name of the script variable (without &) |
Content |
Value that should be assigned to the script variable |
Comments
Use this script statement in combination with the function ACTIVATE_UC_OBJECT as shown below:
- Store script variables with :PUT_READ_BUFFER
- Activate objects using ACTIVATE_UC_OBJECT
- :READ can now be used to access stored script variables in the script of the activated object
:PUT_READ_BUFFER stores the script variable in a separate storage area and assigns an internal ID to it. Call this statement for each value to be stored. It is then stored in the same memory area.
The parameter variable name is specified without the character "&" which is used with script variables.
Trailing spaces are removed when executing :PUT_PROMPT_BUFFER commands.
Note that you cannot write complete script arrays to the input buffer.
When ACTIVATE_UC_OBJECT is called in the script, the memory area is considered complete. As described above, the activated object can now access the script variables of this memory area.
The statement :PUT_READ_BUFFER which is used after the function ACTIVATE_UC_OBJECT uses a different storage area and assigns a new ID.
The following applies for reading script variables from the input buffer:
- With the statement :READ, script variables are read individually. This requires the character "&" be put before the variable name.
- Each script variable can only be read once. It is deleted from the input buffer as soon it is read.
This script element can also be used to set the PromptSet values for the object which has been activated with ACTIVATE_UC_OBJECT. In this case, the name of the ReadBuffer variable must comply with the name of a PromptSet variable of the started object.
Multiple use of Variable Names
It is also possible to call :PUT_READ_BUFFER several times with the same variable name. The value is not overwritten because the statement creates an individual entry for each call in the memory area. :READ always starts searching at the beginning of the memory area when it reads a script variable. The variable's value that occurs first is returned. Then, the entry is deleted. When the script variable is read the next time, the value of its next occurrence is returned. The huge advantage is that values can be set and read in a loop.
Examples
In this first example, the script variable "DATE1" is supplied with a value and moved into the input buffer. Then the job "EVALUATION" is activated.
:PUT_READ_BUFFER DATE1# = "01.01.2006"
:SET &ACTJOB# = ACTIVATE_UC_OBJECT(JOBS,
EVALUATION)
The job "EVALUATION" uses the entry in the input buffer.
:READ &DATE1#,,
:SET &RET# = VALID_DATE("DD.MM.YYYY:&DATE1#")
The second example writes a particular value of a script array to the input buffer. Note that you cannot write a complete array to the input buffer.
:DEFINE &ARRAY#,string,5
:SET &ARRAY#[1] = "test1"
:PUT_READ_BUFFER TEST# = &ARRAY#[1]
:SET &AKTJOB# = ACTIVATE_UC_OBJECT(PRINT)
The activated "PRINT" object reads the value from the input buffer and writes it to the activation log.
:READ &TEST#,,
:PRINT "&TEST#"
The third example writes multiple values to the prompt buffer for a prompt where the Multi select box is checked. In this case, the "VARA#" is the name of the variable selected as the Data reference for the PromptSet element.
:PUT_PROMPT_BUFFER "VARA#[]"="VALUE1"
:PUT_PROMPT_BUFFER "VARA#[]"="VALUE2"
The fourth example job puts the name of its agent to the input buffer and then calls a notification:
:SET &att_host# = GET_ATT(HOST)
:PUT_READ_BUFFER host# = '&att_host#'
:SET &ret# = ACTIVATE_UC_OBJECT('CALLOP')
Notifications can read agent names:
:READ &host#,,
:PRINT "Agent: &host#"
See also:
Script element | Description |
---|---|
Queries the user in a dialog | |
ACTIVATE_UC_OBJECT | Activates an object |
Script Elements - Activate Objects
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by function