🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators DisplayMode
This page was created by Hans.karlsen on 2025-03-31. Last edited by Wikiadmin on 2026-07-29.

You can use the `DisplayMode` property on `selfVM` to make an OCL expression respond to the way the current ViewModel is being used.

What DisplayMode tells you

A ViewModel can be used in more than one context. `selfVM.DisplayMode` identifies the current context so that your OCL can distinguish an interactive UI request from technical processing or a REST request.

For example, use `DisplayMode` when an expression must behave differently when the ViewModel is rendered for a user than when the same ViewModel is used by a transform or other technical process.

Available values

`DisplayMode` has a value from `DisplayModeEnum`:

enum DisplayModeEnum {
  UINormal,
  UIModal,
  UIPopup,
  Technical,
  RestPost,
  RestGet,
  RestPatch,
  RestPut,
  RestDelete
};
Value Current ViewModel use
`UINormal` The ViewModel is used in a normal UI.
`UIModal` The ViewModel is used in a modal UI.
`UIPopup` The ViewModel is used in a popup UI.
`Technical` The ViewModel is used outside the interactive UI, including technical processing and MVC page rendering.
`RestPost` The ViewModel is used for a REST POST request.
`RestGet` The ViewModel is used for a REST GET request.
`RestPatch` The ViewModel is used for a REST PATCH request.
`RestPut` The ViewModel is used for a REST PUT request.
`RestDelete` The ViewModel is used for a REST DELETE request.

Use DisplayMode in an expression

Read the property from `selfVM` and compare it with the context your expression requires.

For example, the following condition tests whether the ViewModel is running in a technical context:

selfVM.DisplayMode = DisplayModeEnum.Technical

Use this pattern when an expression should identify technical execution rather than an interactive UI. For a UI-specific condition, compare the property with the applicable UI value, such as `DisplayModeEnum.UIModal`.

When DisplayMode is Technical

`selfVM.DisplayMode` is `Technical` when the ViewModel is used as a template in these contexts:

  • Transform
  • DeepClone
  • ServerSide
  • SysAsyncTickets
  • OpenDocument Reports
  • Tajson
  • MVC page rendering

Important distinction for MVC

MVC-rendered pages have `DisplayModeEnum.Technical`. Do not test for `UINormal`, `UIModal`, or `UIPopup` when you need to identify MVC rendering.

Design guidance

  • Use `DisplayMode` when the same ViewModel has different behavior in UI, technical, or REST use.
  • Treat the three UI values as distinct UI presentation contexts: normal, modal, and popup.
  • Test explicitly for `Technical` when your logic applies to transforms, server-side processing, reports, or MVC rendering.
  • Test the individual REST value when your logic needs to distinguish the current REST request type.

See also