🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
MDriven Designer and Modlr extensions–exporting data
This page was created by Alexandra on 2018-11-28. Last edited by Wikiadmin on 2026-09-11.

You can create reusable plugin ViewModels in MDriven Designer to inspect any model's ExtendedModelLayer metadata and export displayed grids to an ODS spreadsheet file.

❗🕜 Warning: This article may contain outdated information. Consider before using any descriptions/solutions, otherwise, it may still be helpful. Help: Synonyms and name changes

What this export does

A model contains more than its business classes. Its model metadata describes classes, attributes, associations, diagrams, ViewModels, report definitions, state machines, and Enterprise Architecture information. This metadata is held in the ExtendedModelLayer meta-model.

This workflow lets you create a separate model that defines a report ViewModel over that metadata. After you install that report model as a plugin, you can open it from another model and inspect or export that model's metadata.

For example, you can create a report that lists every class with more than three attributes, all ViewModels ordered by name, or all process steps recorded in EA-Information.

This is a ViewModel plugin approach. It does not require you to write a compiled extension. For compiled extensions and programmatic access to model objects, see Documentation:Modlr plugin.

Before you begin

You need:

  • MDriven Designer and a model you want to inspect.
  • A separate MDriven model file in which to define the plugin ViewModels.
  • An available plugin-model folder that MDriven Designer loads when it starts. The original workflow uses %ProgramData%\CapableObjects\Plugins.

A Modlr file is a zipped model format. Keep the export definitions in their own model so that you can reuse the same reports with multiple target models.

How it works

The workflow has two models:

Model Purpose Example
Plugin definition model Contains ViewModels whose types and expressions refer to ExtendedModelLayer. A ViewModel named ClassesWithMoreThanThreeAttributes.
Target model The model whose metadata is evaluated and displayed when you open the plugin view. Your application model containing classes, diagrams, and EA-Information.

When you run a plugin ViewModel from the target model, its expressions execute against the ExtendedModelLayer instance that represents the target model. The plugin definition model supplies the report definition; it is not the data being reported.

Create an ExtendedModelLayer plugin model

  1. Start MDriven Designer.
  2. Select File/Plugins/Open new meta-model for plugins. This opens the ExtendedModelLayer meta-model as the basis for your plugin model.
  3. Create a new ViewModel over the imported meta-model.
  4. Add the transformations, columns, and UI hints that describe the information you want to show.
  5. Save the plugin model in the plugin-model folder.
  6. Restart MDriven Designer so that it loads the saved plugin model.

The ExtendedModelLayer includes the basic ModelLayer information, such as classes, attributes, associations, and state machines, and adds model-design information such as diagrams, ViewModels, report definitions, and EA-Information.

Define report ViewModels

A ViewModel is a series of transformations that produces a view of part of a model. In this workflow, the source objects are metadata objects in ExtendedModelLayer. Use OCL expressions to select, order, and transform those objects.

Example: find classes with more than three attributes

Use the following expression to select classes whose features include more than three attributes:

Class.allinstances->select(c|c.Feature->filterontype(Attribute)->size>3)

The expression starts with all metadata Class instances, filters each class's Feature collection to Attribute instances, and retains classes where that count exceeds three.

Example: list ViewModels by name

Use the following expression to list metadata spans in name order:

Span.allinstances->orderby(name)

Example: export Enterprise Architecture information

EA-Information records cross-referenced business information such as processes, actors, applications, information, and infrastructure. Define a ViewModel that navigates the appropriate ExtendedModelLayer EA-Information objects and presents process and process-step columns in a grid. You can then run that same ViewModel against any target model that contains the relevant EA-Information.

Run a plugin view against a model

  1. Restart MDriven Designer after saving or changing the plugin model.
  2. Open the target model that you want to inspect.
  3. Right-click a node in the model tree.
  4. Choose Plugin Views.
  5. Select the ViewModel you created.

MDriven Designer opens a form derived from the ViewModel definition and evaluates it against the target model's ExtendedModelLayer. If the result does not contain the columns or ordering you need, return to the plugin definition model, change the ViewModel, save it, restart MDriven Designer, and run the plugin view again.

Export a displayed grid to ODS

Plugin-view forms provide export buttons at the bottom of the form. Use the ... To Excel button for the grid you want to export. The export creates an ODS (OpenDocument Spreadsheet) file, which you can open in Excel and other spreadsheet applications.

Export the grid only after you have shaped it into the required report. For example, add columns for a class name and attribute count before exporting the class query, rather than exporting the raw metadata objects.

Reuse and maintain reports

Keep each report definition in the separate plugin model. A report written against ExtendedModelLayer is reusable: after MDriven Designer loads the plugin model, you can run it against current and future target models.

Use clear ViewModel names that explain the report result, such as AllViewModelsByName or ClassesWithMoreThanThreeAttributes. This makes the correct choice easier to find in the Plugin Views menu.

Do not confuse this interactive ODS export with server-side file production. If you need MDrivenServer to write XML, transformed text, or byte-array file data as part of a periodic server-side action, use Exporting files from MDriven Server.

Troubleshooting

Problem Check
The ViewModel is not available under Plugin Views. Confirm that the plugin model is saved in the plugin-model folder that your installation loads, then restart MDriven Designer.
The view opens but shows unexpected data. Remember that the expression runs against the target model's ExtendedModelLayer. Check the target model for the metadata that the expression selects.
A report change is not visible. Save the plugin definition model, restart MDriven Designer, reopen the target model if necessary, and run the plugin view again.
You need access through code rather than a derived ViewModel form. Use the compiled-extension approach described in Documentation:Modlr plugin.

See also

How It Is Done

Right-click the package to access import and export options. 2. Right-click package, import/export, and Import from EcoSpace in Assembly (new function).

Import all packages and their content into your new model. 4. Then, get all the packages and their content imported into your new model.

A form executes your ViewModel definition on the ExtendedModelLayer. 8. A form comes up, and executes your ViewModel definition on the extendedmodellayer that holds your model:

Export buttons at the bottom of the form create ODS files. 9. It also holds Buttons at the bottom that create ods files for you, so that you can get the values in Excel:

Continued

Create a ViewModel for the ExtendedModelLayer to inspect your model. Following the steps above, I created a ViewModel for ExtendedModelLayer:

Open a second instance of MDriven Designer with your target model. While I have it open, I start a new instance of AppComplete and load the model that wanted to dump the processes:

Right-click any node in the tree to access Plugin Views. Right-click any node in the tree and pick the “Plugin Views” and the correct ViewModel:

Refine your ViewModel and restart to see updated results. Great. If you do not like the result, fix it in AppComplete #1,  save, restart AppComplete#2, and try again:

Press the To Excel button to export your grid results. Better. Now I can press the “… To Excel” button: