🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
OCLOperators CanExecuteAction

CanExecuteAction is an OCL operator used in MDriven to check whether a given action can be executed within a specific ViewModel nesting before you actually run it with ExecuteAction. It returns a Boolean (true or false).

Syntax

selfVM.CanExecuteAction(nameofNesting, nameofAction) : Boolean

Example

Suppose you have a ViewModel nesting called "OrderList" and an action named "ApproveOrder".

selfVM.CanExecuteAction('OrderList', 'ApproveOrder')

Returns true: you can execute the 'ApproveOrder' action now.

Returns false: you cannot execute it yet (e.g., no order selected or business rule disallows it).



Arguments

nameofnesting: String

Name of ViewModel Nesting.

nameofaction: String

The ActionName to check for.

See also: