%setlist keyword (SDL script)
This keyword sets the content of a global list of Modeler items. You can set the list to the current item by setting the list to 'This'. You can set a list to the content of list unions and intersections, and you can set a list to the items that are linked to the current item through a specific link type.
The current item is derived as follows:
ACS calls the top-level Generate.sdl generation template for each item (Model, Package or Class) that is selected either directly or indirectly for generation. On entering the Generate.sdl generation template, the selected Model, Package or Class is the current item.
The current item remains as the selected Model, Package or Class until a For loop iterates a collection of linked items or items in a list. During a For loop, the current item is the item that is currently being iterated.
After leaving a For loop, the current item reverts to the item that was the current item before entering the For loop.
* 
Before setting a global list, you must declare it using the %list keyword. You can read the content of a global list through the %getlist keyword.
Syntax
To set a list to the current item:
%setlist "<name of list>" = "This"
To set a list to the content of another list (set to intersection or union of list with itself):
%setlist "<name of list>" = %getlist "<name of list>" * %getlist "<name of list>"
To set a list to the union of two other lists:
%setlist "<name of list>" = %getlist "<name of list>" + %getlist "<name of list>"
To set a list to the intersection of two other lists:
%setlist "<name of list>" = %getlist "<name of list>" * %getlist "<name of list>"
To clear a list:
%setlist "<name of list>" = ""
To set a list to the items linked to the current item:
%setlist "<name of list>" = "<link type>"
The <link type> is the automation interface name of the link type that links the current item to other items. For more information about the automation interface names of link types, see Object Attributes and associations under the Automation Interface chapter of the Windchill Modeler Help", and then click the required item type. The link types are listed in the Associations section.
Setting a list to the intersection of two lists
Setting a list to the items linked to the current item
Example 9. Setting a list to the intersection of two lists
This example works in the context of a Class. The For loop processes each Attribute of the Class in turn. For each loop, the CurrentObject local list is set to the current Attribute and then the ChildAttributes global list is appended with the CurrentObject local list. After the For loop, the list2 list is set to the content of the ChildAttributes list.
Notice that the global List2 list is set to the content of the ChildAttributes list by intersecting the ChildAttributes list with itself.
%setlist "ChildAttributes" = ""
%for "Attribute"
%setlocallist "CurrentObject" = "This"
%setlist "ChildAttributes" = %getlist "ChildAttributes" + %getlocallist "CurrentAttribute"
%endfor
%setlist "List2" = %getlist "ChildAttributes" * %getlist "ChildAttributes"
Example 9. Setting a list to items linked to the current item
In this example, the current item is a Class. The ChildAttributes list is set to the collection of child Attributes, which are linked to the Class through the Attribute link type.
%setlist "ChildAttributes" = "Attribute"
Was this helpful?