You can also import model elements through a class mapping. A class mapping contains properties of a schema class and a target element that you have mapped together. The type of the target element that you selected in the class mapping determines how the plugin imports and creates the model elements. If the target element is a user model, the plugin will import data as instance specifications of the user model. However, if the target type is a element in UML or a SysML profile, the plugin will import data as UML or SysML element type respectively.
Importing data through a class mapping requires the number and the name of columns in the file to be the same as those in the selected class mapping.
The Import Data from Excel menu in the Import Data from Excel and Create Mapping dialog, see figure below, opens the wizard that allows you to import data according to the class mapping you created. This menu is also useful if you want to import data from an Excel or CSV file as instance specifications of the schema class you have imported. See section Importing Instance Specifications after Creating a Schema Class for details on importing instance specifications using the Import Data from Excel menu.
You can open the wizard to import elements from a class mapping through either (i) The main menu or (ii) The context menu. If you want to import elements by using the main menu, you need to click File > Import From > Excel/CSV File > Import Data from Excel. If you use the context menu, you can right-click a class mapping in the Containment tree in MagicDraw and select Tools > Import Data from Excel.
Either method opens the Import Data from Excel wizard. The only difference is that the context menu will choose the class mapping, which you have already selected in the Containment tree, in the Select a mapping option page by default. However, you can change the default class mapping in the wizard to another one.
(ii) To import data according to a class mapping through the main menu
To import data according to a class mapping through the context menu
(i) to find a file and click .
(ii) and skip the following steps.
If you click at this point, the wizard will:
|
(iii) to select the sheets of using the Select sheets option, see the first figure below. If you are importing a CSV file, the wizard will skip the Select sheets page and open the Select a mapping page, see the second figure below.
The Select sheets option page will not open if:
|
4. Select one or more sheets in the Excel file with the data to import and click . The class mapping you have selected in the Containment tree will open in the Select a mapping option page, see figure below.
5. You can select another class mapping from the treeview.
6. Click either (i) to import the element into the package where the class mapping is located, or (ii) to select a package to store imported elements through the Select a package option page, as shown in the figure below.
7. Select, create, or clone a package to store the to-be-imported elements or instance specifications from the treeview, see figure above.
8. Click .