Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > Transformation Development Kit (TDK) > Customizing an ACS Code Generator DLL > Working with SDL script > Working with variables and item lists in SDL script (TDK)
  
Working with variables and item lists in SDL script (TDK)
SDL script supports variables and item lists.
* 
There are SDL script extensions for TDK that you can use in SDL script that is processed by TDK. For information about TDK generation template extensions, see Overview of SDL script extensions for TDK (SDL script).
Variables
The generation templates support global and local variables of type string and numeric.
For detailed information about keywords for working with variables, see Overview of keywords (SDL script).
You must declare a variable before you using it. A local variable can exist only in the context of the generation template or 4G Generation Class that declares it. You declare variables using the following keywords:
%localnumeric — declares a local numeric variable.
%localstring — declares a local string variable
%numeric — declares a global numeric variable in the Generate.sdl template
%string — declares a global string variable in the Generate.sdl template
After declaring a keyword, you can set its value through these keywords:
%setlocalvar — sets the value of a local variable.
%setvar — sets the value of a global variable.
You can get the value of a variable through these keywords:
%getlocalvar — gets the value of a local variable.
%getvar — gets the value of a global variable.
When you load a generation template, you can pass a local variable as a parameter and use that passed parameter in the called generation template through these keywords:
%param — specifies local variables to pass as parameters when loading a generation template.
%setparam — sets the value of a local variable that has been passed as a parameter to a called generation template.
%getparam — gets the value of a local variable that has been passed as a parameter to a called generation template.
In addition, you can use the %isin keyword to search for a substring in a string, where either string can be a variable.
Item lists
SDL Script supports item lists, which list one or more Modeler items.
For detailed information about the keywords for working with item lists, see Overview of keywords (SDL script).
You must declare an item list before you using it. An item list can be global or local. A local item list can exist only in the context of the generation template or 4G Generation Class that declares it. You declare an item list using the following keywords:
%list — declares a global list variable.
%locallist — declares a local list variable.
After declaring an item list, you can set it. A list can be set to the current item by setting it to This. You set an item list through these keywords:
%setlist — sets the items in a global list.
%setlocallist — sets the items in a local list.
You can get the value of an item list through these keywords:
%getlist — gets the items from a global list.
%getlocallist — gets the items from a local list.
You can search for the current item in a list through these keywords:
%inlist — searches for the current item in a global list.
%inlocallist — searches for the current item in a local list.
You can evaluate list intersections and unions through these operators:
* operator — for evaluating list intersections.
+ operator — for evaluating list unions.
You can use a For loop to iterate through the items in a list.