Attribute 'parameterstringof'
The pragma can be used to access the instance name of a variable using the visualization.
Syntax: {attribute 'parameterstringof' := '<variable>'}
Insertion location: Line above the declaration line of a variable
Example:
In the main program, the instance stData of the user-defined structure ST_Data was created:
PROGRAM MAIN
VAR
stData : ST_Data;
END_VAR
This instance is the input for a visualization "Visu" (in the input/output parameter stInstance). The visualization is referenced by a frame of another visualization, "MainVisu".
The settings of the frame element in "MainVisu" look like this:
The input/output variable stInstance and a further input variable sInstanceStr are declared in the interface editor associated with the visualization "Visu":
Although sInstanceStr is an input variable, it is not listed as input in the reference (see top image). This is because the variable sInstanceStr has the attribute 'parameterstringof' and is therefore automatically initialized with the name of the variable that was specified in the attribute. In the example, stInstance is the corresponding variable. The string variable sInstanceStr is therefore set to MAIN.stData and can now be used within the visualization "Visu", for example as a text variable for a placeholder "%s“.