Code Window for Definitions
- Updated2026-04-22
- 3 minute(s) read
PAscript requires the definition of all libraries and variables, to be used in your code.
Variables that are used in the test are defined on the Global Variables tab. Additionally required local variables are defined on the Local Variables tab. All libraries you want to include are declared on the Libraries tab.
Namespaces Tab
In the Namespaces tab, you can reference both libraries and namespaces that you want to use in your state machine. Libraries and namespaces are created in PAconfigurator and included in the code with the using keyword.
Subsequently access public elements of the library in the code directly. To do so, specify the library name followed by a colon and the name of the public element. For global classes, you must first create an instance of this class as a local variable.
To open the Namespaces tab, click in the Explorer on the Namespaces node. List all namespaces and libraries that you want to use in the state machine. Separate the individual elements of a namespace with a colon.
Global Variables Tab
Define all variables in the test that you use in the code as global variables.
- In the Explorer, click the Global variables node. The Global variables tab opens.
- Enter all of the global variables that you want to use in the state machine.
Local Variables Tab
You must define all counter variables for loops, auxiliary variables etc. that are not present in the test as local variables. You must also call the constructor function of global classes for instantiation with the local variables. Enter the complete namespace followed by the class name as the data type.
In the Explorer, click the local variables node to open the Local Variables tab. Enter there all the global variables that you want to use in the state machine.
Functions Tab
In PAgraph programs, too, you can define functions that are only valid in this single program. Click the Functions node in the Explorer to open the Functions tab, then enter the code for the function body.
Related Information
- PAscript Libraries
Save libraries in the database as global objects. All tests can use libraries.
- Namespaces
Use namespaces to uniquely identify objects in object-oriented programming languages and assign objects to a structure.
- Defining Global Variables for PAgraph
Define a test variable or test object as a global variable to use the variable or object in the state machine code.