MagicDraw 18.3 Documentation

Skip to end of metadata
Go to start of metadata

 The basic steps to create an Instance Table are:

Creating an empty Instance table

To create an empty Instance Table


  1. In the Containment tree, select an element that can be the owner of the Instance Table.
  2. Do one of the following:
    • From the main menu, select Diagrams > Create Diagram. Type “ins” and press Enter.
    • On the main toolbars, click the Create Diagram button. Type “ins” and press Enter.
    • Press Ctrl+N. Type “ins” and press Enter.
    • Right-click the element and from the shortcut menu select Create Diagram > Other Diagrams > Instance Table.
    The newly created Instance Table opens on the right side of the application window.
  • If the default name of the Instance Table is not appropriate, type a new one directly in the Containment tree.
  • If the owner of the Instance Table is also a classifier, it becomes the default value of the Classifier box in this Instance Table.
    Owner of the Instance Table becomes classifier by default

Specifying the classifier

Specifying the classifier criteria is necessary, because you are not be able to add a single instance to the table until the classifier is unknown.

To specify the classifier for the Instance Table


  1. In the Criteria area of the Instance Table, click the ... button next to the Classifier box. The Select Classifier dialog opens.
  2. Select one or more elements and add them to the Selected elements list. These are the elements that can be selected:
    • Classifier.
    • Classifier that owns other classifiers. In this case, the classifier and all the classifiers owned by it is specified as criteria.
    • Package that contains classifiers. In this case, the contents of the package, but not the package itself is specified as criteria.
  3. Click OK when you are done.
  • To specify the classifier, you can also drag a selected element to the Classifier box directly from the Model Browser.
  • To select adjacent elements, select a single element and then hold down the Shift key while you click other elements.
  • To select nonadjacent elements, select a single element and then hold down the Ctrl key while you click other elements.
  • Keep in mind that the new value of the Classifier box replaces the old value.
    Using drag-and-drop operation to specify classifier for Instance Table

Once the classifier is specified, the following columns are displayed in the Instance Table (on the right of the row number # column):

  • Name which is up to display the names of the instances of the specified classifier.
  • Columns corresponding to the Data type attributes of the specified classifier and named after these attributes using the sentence style capitalization. The columns are up to display the slot values of the instances of the specified classifier.

Selecting columns to display

The Instance Table by default shows nine columns, including # (row number), Name (instance name), and the columns for instance slot values, that correspond to the first seven Data type attributes of the specified classifier. The rest of the columns are by default hidden, though you can show them if there is a need.

You can select to show any column that corresponds to one of the following:

Instance Table column names

To display attributes of the classifier


  1. On the table toolbar, click the Columns button and then click to select the check boxes nearby the attributes you want to show.

 

To display properties and tags


  1. On the table toolbar, click Columns > Select Columns. In the Select Columns dialog choose columns which you want to display in the Instance Table by selecting the appropriate check boxes of the properties and tags.

    All columns that you have chosen to display also appears on the menu of the Columns button.

    Displaying properties and tags in the Instance Table

 

To display nested properties of the classifier


  1. On the table toolbar, click Columns > Select Nested Columns. In the Select Nested Columns dialog choose columns which you want to display in the Instance Table by selecting the appropriate check boxes of the nested properties.

    To specify nested columns, click the Create with Parts button, when creating a new instance with parts.


    Displaying nested properties as columns in the Instance Table


If you add a new attribute to the classifier and need to display the corresponding column in the Instance Table, open the Select Columns dialog and click to select the appropriate check box.

Keep in mind that columns corresponding to newly created attributes firstly are available only in the Select Columns dialog (until you select to show them).

 

Filling the table with instances

You can fill the Instance Table for the specified classifier in the following ways:

 

To create a new instance


  1. On the table toolbar, click the Create button.

    The new instance can be created only if the classifier is already specified for the Instance Table. Otherwise the Create button is not available.

    If there is more than the one classifier specified, from the menu of the button, select a classifier for that you need to create an instance.
    More than the one classifier specified in the Instace Table

    The new instance is added to the Instance Table as the last row.

  2. Type the instance name and specify slot values.

 

To create a new instance with parts


  1. On the table toolbar, click Create > Create with Parts.

    The new instance with nested parts is created if:

To add an existing instance


  1. On the table toolbar, click Create > Add Existing. The Select Instance Specification dialog opens.
  2. In the tree or list on the left side of the dialog, select an element and add it to the Selected elements list. You can select more than one element. Elements available for selection:
    • Instances of one or more classifiers specified for the table. An instance is available, if it belongs to at least one of the classifiers.
    • Packages that contain these instances. In this case, the contents of a selected package, but not the package itself will be added to the table.
  3. Click OK when you are done.
    The selected instance is added to the table as the last row.

    • You can just drag a selected element to the contents of the Instance Table directly from the Model Browser.
    • To select adjacent elements, select a single element and then hold down the Shift key while you click other elements.
    • To select nonadjacent elements, select a single element and then hold down the Ctrl key while you click other elements.

To copy and paste an instances from another resources


  1. Choose the columns of instance slot values that you want to fill with copied information.

    The cells must be editable in the Instance Table.

  2. Copy the content of the table from another resource.

    • The number of columns in that table should be the same as the number of columns in the Instance Table
    • The data types of columns in the instance table must be compatible with copied information.
  3. Press Ctrl+V (Cmd+V on OS X).
    Each row displays one instance with its slot values.

    • If instance already exists in the model, the information updates.
    • If instances have an ID prefixes in another resource, they are set automatically after copy-and-paste command only for pasted instances in the Instance Table. Manage ID prefixes in the Element Numbering dialog.

    Copy and paste instances in the Instance Table from another resource

Specifying instances as slot values (optional)

If the slot type is a classifier, you can specify an instance of this classifier as the slot value. Do this in one of the following ways:

  • By creating a new instance.
  • By selecting an already existing instance.

To select an instance from the model, simply click Edit in the slot value cell and choose the instance from the tree or list in the open dialog.

To create an instance as slot value in the Instance Table


  1. Select the slot value cell.
  2. Click Create Instance Specification. If the slot type has subtypes, choose one of them.
    Choosing subtype for new instance

    The new instance is simultaneously created in the model and set as the slot value. You can see this instance in the Model Browser, where it is owned by the classifier, which is a type or a subtype of the selected slot.

To remove an instance from the cell


  1. Select the cell.
  2. Click Remove.
    The instance is removed from the Instance Table, but not from the model.

  • No labels