To retrieve the Server Project Version in a Diagram
- Right-click the empty space on the diagram pane and open the Specification window.
- On the left side of the dialog, select Traceability > Create. Expression dialog opens.
Select Create operation > Script.
If you cannot see the Script operation under Operations, make sure the Expert mode is enabled.
- Specify the Name for the derived property.
- Set the Type as String.
- Specify the Operation Name.
- From the Language drop-down list, select JavaScript Rhino.
Insert the following script as the Body.
JavaScript Rhinovar prj = com.nomagic.magicdraw.core.Application.getInstance().getProject().getPrimaryProject(); var ver = com.nomagic.magicdraw.core.ProjectUtilities.getVersion(prj); ver.getName();
- Click OK.
To display the Server Project Version in a Diagram
- Create the Note symbol in the diagram and anchor it to the diagram.
- Right-click the Note symbol and deselect Represent Diagram Context (Package).
- (Optional) Right-click the Note symbol and deselect Apply SysML Callout Style.
- Right-click the Note symbol and select Edit Compartments.
- In the Element Properties tab of the Compartment Edit dialog, select the name of the property you created.
- Click OK. You can see the property name and the server project version in the Note symbol.