ScriptEigener Objekttyp in der Automation Engine function: Replaces script variable names by their values.
Syntax
STR_SUB[STITUTE]_VAR(Variables)
Syntax |
Description/Format |
---|---|
Variables |
Script variable or string that includes one or several variable names. |
Return code |
---|
String with the script variable's values. |
Comments
The script variable STR_SUB_VAR can be used to replace one or several script variable names that are stored as a string in a different script variable by the actual variable value. The following examples illustrate this behavior.
The script element GET_PROCESS_LINE includes a parameter that is also called STR_SUB[STITUTE]_VAR. It makes the same replacements in data sequence lines.
Examples
The following example stores a script variable's name (&VAR#) in a different variable (&VAR_NOSUB#) by using the & character twice.
If &VAR_NOSUB# is output, the name of the script variable &VAR# is written to the activation protocol. The script element STR_SUB_VAR serves to replace this name by the variable's value.
:SET &VAR# = "script variable"
:SET &VAR_NOSUB# = "&&VAR# = &VAR#"
:PRINT &VAR_NOSUB#
:SET &VAR_SUB# = STR_SUB_VAR(&VAR_NOSUB#)
:PRINT &VAR_SUB#
Output in the activation protocol:
2011-05-06 10:34:04 - U0020408 &VAR# = script variable
2011-05-06 10:34:04 - U0020408 script variable = script variable
The second example retrieves a value from the VariableSpeichert oder ermittelt Werte dynamisch zur Laufzeit. Auch ein eigener Objekttyp in der Automation Engine. object VARA.SUB which includes the names of two script variables. These two script variables are created and set.
Only the script variable names are written to the report if the Variable object's value is directly output. They are not replaced by their values.
The script element STR_SUB_VAR is used to replace the names of the two script variables by their values.
:SET &VARA# = GET_VAR(VARA.SUB, "SUBVAR")
:SET &VAR1# = "Hello"
:SET &VAR2# = "World"
:PRINT "Content without replacements: &VARA#"
:SET &VARA_SUB_VAR# = STR_SUB_VAR(&VARA#)
:PRINT "Content with replacements: &VARA_SUB_VAR#"
Output without and with STR_SUB_VAR:
2011-05-06 10:34:04 - U0020408 Content without replacements: &VAR1# &VAR2#
2011-05-06 10:34:04 - U0020408 Content with replacements: Hello World
See also:
Script element |
Description |
---|---|
Retrieves a data sequence's current line content. |
Script Elements - Activating Objects
Sample Collection
Notification with a Variable Message Text
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function