🚀 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-07-29.

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.

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