🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Practical Expressions for Model Content Insights
This page was created by Wikiadmin on 2026-07-29. Last edited by Wikiadmin on 2026-07-29.

You can run these OCL expressions in the MDriven Designer Model Debugger to inventory ViewModels and actions in your model.

Before you run the expressions

These expressions query the MDriven model itself, not the business objects represented by your model. They use meta-model types such as Span and AbstractAction to inspect ViewModels, their columns, and their actions.

You can execute the expressions only in the MDriven Designer Model Debugger. To open it, right-click in an applicable Designer location and choose Extras and then Open Model Debugger.... Enter an expression in the debugger and execute it to inspect the resulting collection.

The expressions return selected properties with collect. Read each returned row as a compact inventory record. For example, the first expression returns the ViewModel name, its class, category, action details, and code comment for every ViewModel that users can open through an action.

Find ViewModels opened by actions

Use this query to list every ViewModel that has at least one action that shows it.

Span.allinstances
  ->select(span | span.ShowByActions->notEmpty)
  ->collect(span |
    span.Name,
    span.Class.Name,
    span.Category.Name,
    span.ShowByActions.ListPresentationTypedDetails->ascommalist,
    span.CodeComment)

This is useful when you need to identify the user-reachable ViewModels in a large model. A ViewModel without an entry in this result may still be used in another way; this query specifically checks ShowByActions.

Find actions that navigate to another ViewModel

Use this query to inventory actions whose BringUpViewModel property is set.

AbstractAction.allinstances
  ->select(aa | aa.BringUpViewModel->notEmpty)
  ->collect(aa |
    aa.Name,
    aa.OclType.asstring,
    aa.ListPresentationTypedDetails,
    aa.MenuGroup.Name,
    aa.ViewModelIsModal,
    aa.ViewModelIsPopUp)

The result shows the action name and type, presentation details, menu group, and whether the target ViewModel is configured as modal or pop-up. Use it when reviewing navigation behavior or locating all actions that open views.

Find server-side ViewModels

Use this query to find ViewModels that are not shown by actions and have server-side execution criteria.

Span.allinstances
  ->select(span |
    span.ShowByActions->isEmpty and
    span.CriteriaForServerSideExecute->notEmpty)
  ->collect(span |
    span.Name,
    span.Class.Name,
    span.Category.Name,
    span.CodeComment)

A returned ViewModel has no ShowByActions entries and has a non-empty CriteriaForServerSideExecute. Review the name, class, category, and code comment together to establish why it runs on the server.

Find OpenDocument report templates

Use this query to find ViewModels that contain the ReportFileName column. That column indicates that the ViewModel is a template for an OpenDocument report.

Span.allinstances
  ->select(span | span.OwnedColumns->exists(c | c.Name = 'ReportFileName'))
  ->collect(span |
    span.Name,
    span.Class.Name,
    span.Category.Name,
    span.OwnedColumns
      ->select(c | c.Name = 'ReportFileName')
      ->first.Expression,
    span.CodeComment)

The fourth value is the expression of the first owned column named ReportFileName. The query checks ReportFileName, not ReportName.

Find actions that do not navigate

Use this query to locate actions with no BringUpViewModel. These actions may change data or perform another operation rather than opening a ViewModel.

AbstractAction.allinstances
  ->select(aa | aa.BringUpViewModel->isEmpty)
  ->collect(aa |
    aa.Name,
    aa.OclType.asstring,
    aa.ListPresentationTypedDetails,
    aa.MenuGroup.Name,
    aa->safecast(ContextAction).ViewModelContext.Name,
    aa->safecast(ClassAction).ClassToPerformActionOn.Name,
    aa.AreYouSureQuestion)

The result includes both context-action and class-action information. The safecast calls let one query retrieve the ViewModel context for a ContextAction and the class for a ClassAction. It also returns the AreYouSureQuestion value, which helps you identify actions that request user confirmation.

Choose the right query

Question Start with
Which ViewModels can an action show? Find ViewModels opened by actions
Which actions open another ViewModel, and how are they displayed? Find actions that navigate to another ViewModel
Which ViewModels have server-side execution criteria? Find server-side ViewModels
Which ViewModels are OpenDocument report templates? Find OpenDocument report templates
Which actions perform work without navigating? Find actions that do not navigate

See also