Skip to content

SHOW_PAGE with parameter binding generates invalid expression (CE0117) #122

@engalar

Description

@engalar

Bug

SHOW_PAGE with $currentObject parameter binding in DATAGRID CONTROLBAR generates an invalid Mendix expression, causing CE0117.

MDL input

DATAGRID dgOrders (DataSource: DATABASE FROM MyModule.Order, Selection: Single) {
  CONTROLBAR cb {
    ACTIONBUTTON btnView (
      Caption: 'View',
      Action: SHOW_PAGE MyModule.Order_Detail(OrderParam: \$currentObject),
      ButtonStyle: Primary
    )
  }
  COLUMN colNum (Attribute: OrderNumber, Caption: 'Order')
}

Result

mxcli creates the page and button, but `mx check` reports:

```
CE0117 Error(s) in expression. Action button 'btnView' Page 'Order_Overview'
```

The generated parameter binding expression for `$currentObject` is invalid in the Mendix model.

Expected

The button should correctly pass the selected DATAGRID row to the target page parameter.


Copied from engalar#41

Comments from original issue

@engalar (2026-04-07T09:20:44Z):
Image
@engalar (2026-04-07T09:27:41Z):

Update: Root cause identified

The issue is not with `$currentObject` per se — it's that inside a DATAGRID CONTROLBAR, there is no DataView context, so `$currentObject` is undefined.

Correct approach

When DATAGRID has `Selection: Single`, the selected row is accessible via the widget name as a variable:

DATAGRID dgOrders (DataSource: DATABASE FROM MyModule.Order, Selection: Single) {
  CONTROLBAR cb {
    ACTIONBUTTON btnView (
      Caption: 'View',
      -- Use \$dgOrders (widget name), NOT \$currentObject
      Action: SHOW_PAGE MyModule.Order_Detail(OrderParam: \$dgOrders),
      ButtonStyle: Primary
    )
  }
}

Suggestion

mxcli should either:

  1. Reject `$currentObject` in CONTROLBAR context with a clear error message pointing to the widget name variable
  2. Auto-resolve `$currentObject` to the DATAGRID widget name when inside a CONTROLBAR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions