Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > SDL script for generating code > Keywords > %setvar keyword (SDL script)
  
%setvar keyword (SDL script)
This keyword sets the value of a global variable.
* 
Before setting a global variable, you must declare it using the %string or %numeric keyword in a Generate.sdl template. You can get the value of a global variable through the %getvar keyword.
Syntax
For a string type:
%setvar "<name of variable>" = "<text>"
For a numeric type:
%setvar "<name of variable>" = <value>
* 
You can also use %setvar to set a variable to the value of a different variable or an extended property.
This example sets the value of a global string variable named cAccess to 'public', and sets the value of a global numeric variable named bRtSSimulation to 1.
%setvar "cAccess" = "public" // sets string global variable
%setvar "bRtSSimulation" = 1 // sets numeric global variable
In this example, the sysSpecExtension is set to its value prefixed with a period.
%setvar "sysSpecExtension" = (".") & (%getvar "sysSpecExtension")