%search statement (SDL script)
This topic applies to TDK SDL script extensions. For more information, see Overview of SDL script extensions for TDK (SDL script).
SDL Script Extensions for TDK:
%search ("", "Class") $ returns a %list that contains all the searchable classes
$ in the model or root item
%search ("TBall", "Class") $ returns a %list with just the TBall class
%search ("", "Class", "C++ Class") $ returns a %list with all the classes in the model that
$ are stereotyped with the «C++ Class» stereotype
%search has 3 string parameters:
The name of the searched object.
The class of the searched object.
An optional stereotype.
Object name must be specified always, but it can be the empty string (means 'no filter on name'). Class name follows the same rule. Stereotype name can be omitted; if present, returned objects are filtered in such a way just stereotyped objects are returned.
When the class of the searched object is Category, for example %search ("", "Category"), the following objects are searchable objects:
Objects that are under the root object in the model structure.
Temporary objects that are created by a M2M code generation pattern.
Objects that are set as 'searchable' explicitly through of the %setsearchable <objref> instruction.
Packages that include 'profile' in their name, and Packages that are nested under a Packages that include 'profile' in their name.
Packages that are stereotyped by the «ACSRoot» stereotype.
When the class of the searched object is a Stereotype, a Tag Definition, Dictionary or Diagrams, all objects in the model are searchable objects, irrespective of what the root object is.
Result can be assigned to a %object or a %list. When result is assigned to %object but more than one object is returned, just the first is considered.
%search can be used where a list expression is expected, for example:
%for %search ("", "Operation")
%message %custom "Name"
%endfor
The above example prints the name of all the operations in the model.
Was this helpful?