MLDesigner supports the definition of complex data types. The difference between MLDesigner data types and the original base types is that you can define arbitrarily structured data types as well as special user defined data types, such as enumerations.
For more detailed information about the structure and programming of MLDesigner data structures refer to the Programming Guide/Using Data Types.
To differentiate between base data types and MLDesigner data types, the latter are principally called Data Structures (DS).
Data structure types are managed in the Data Editor found in the top right corner of the MLDesigner user interface. You can show or hide the data type editor using the Data Type View On/Off tool button in the standard toolbar.
The data type editor consists of two regions. The upper region contains a tree which shows the hierarchy of data structures. The lower region displays members or enumeration elements of the currently selected data structure. The type of data structure is indicated by different icons for structured types and base types. The icon color indicates whether they are editable or not.
A green icon means that a data structure is editable, that is, it is defined in a writable library. Red icons indicate read-only data structures.
User-defined Data Structures are defined as part of a library and are only available when the library in which they were created is open in the Model Editor window.
You will notice three logical items in the data structure tree. These are expandable items without a red or green icon. These items serve to group structures of the same type as indicated by the name of the folder or sub folder. These types are:
The context menu in the tree view of the Data Editor, offers some standard menu items for navigating the tree such as Expand, Collapse, Expand All and Collapse All. Other options are create New Data Structure, Edit existing structure or base type, View, and Delete items (depending on permissions).
To create a new DS at least one editable library must be open in the design area. Right-click anywhere in the Data Structure tree view and select New Data Structure or click on the equally named button on the Data Structure toolbar. This will open the Data Structure Editor dialog, there you can create and edit data structures of type:
The data structure type can be selected from the drop-down menu Kind. On selecting a type from the drop-down list, certain input fields change dynamically. The Name, Library and Description fields are common to all data structures with Description being the only optional field. The Name must be a valid identifier. The Library combo box lists all open editable libraries. Choose a location to create the new data structure in. Once the data structure properties are defined, click the Save button.
To add a new member to a composite data structure, open the context menu by right-clicking anywhere in the lower section while the data structure is selected in the upper section's tree and choose New Member... or click on the New Member/Element toolbar button.
Note that this menu item, just like the delete item, will only appear if the data structure is editable.
The blank member editor dialog will open. Fill in a name (must be a valid identifier) and give a description for the new member (optional). By default, Root is set as the type of a new member. This can be changed by choosing from a tree of data structures using the tool button next to the type name field. If a base type is chosen as member type, the Default Value field becomes editable, and only if a numeric base type is used as member type, the Subrange field is activated. The subrange field is used to define an interval of valid values for numeric members, given in the usual mathematical notation with the keyword Inf (case insensitive) meaning infinity.
|(-Inf,2)||an interval with no bottom limit and the upper limit being 2, excluding 2 itself|
|(-Inf,4]||an interval with no bottom limit and the upper limit being 4, including 4|
|[3.45, 9.3)||3.45 is included, 9.3 is excluded|
From the drop-down menu in the Subrange field, you can select an entry from a list of commonly used subranges. After all fields are filled, click the Save button to save the new member in the library defining the parent data structure.
To edit a composite data structure member right-click on the member and choose Edit... to open the Data Type Member Editor for this member.
If the data structure is not editable, only a View item will be available which opens the same editor without editing capabilities.
Since elements can only be edited in the composite data structure of their origin, inherited elements are not editable and have a gray background.
If the permissions allow for modifying the parent data structure, you can delete composite data structure member using the Delete... item of the context menu for members. After confirming a warning message, the member is removed.
Note that the library is saved immediately and there is no way to undo deleting a member.