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 > SDL script extensions for TDK > Set/get properties and associations access with '.', ':' and '->' notations (SDL script)
  
Set/get properties and associations access with '.', ':' and '->' notations (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:
%string A
%object B
......... Set B to a valid object ...............
A = B.Name $ No space in the member name
A = B."Generated Code Name" $ Spaces allowed in the member name
B."Alias Generated Code Name" = A
A = B:Name $ As A.Name, forced as property
%list L
L = B->Attribute $ Retrieves the Attribute association, forces list
Properties and associations can be extracted from objects with the above operators.
The ':' operator extracts (or assigns) the right property from the left object.
The '->' operator extracts (or assigns) the right association from the left object
The '.' operator extracts (or assigns) either a property or an association. It can be used when no ambiguity exists, that is, when the specified property (or association) does not collide with an association (or property).
Example:
A = B."Data Type" $ WRONG – a "Data Type" association also exists, behavior is
$ undefined
A = B:"Data Type" $ CORRECT for getting the Data Type property
A = B->"Data Type" $ CORRECT for getting the Data Type association
The -> and : operators can be combined for extended navigation expressions, like for example:
$ extracts the list of classes associated with AClass by means of associations directed
$ from AClass to the other classes:
A = AClass->"Association Start"->"End Role"->Class
$ extracts the name of the package that contains the class whose AnAttribute is a member
A = AnAttribute->Class->Package:Name
When a combination of -> and : is used (like in the last example), the resulting list shall have 1 cardinality, otherwise a runtime error will be raised