Skip to content

Commit 9c1d144

Browse files
akoclaude
andcommitted
feat: accept \$var/Module.Assoc as widget DataSource (mendixlabs#198)
The grammar rejected association-path expressions as data sources for DATAGRID/LISTVIEW/GALLERY, requiring the more verbose \`ASSOCIATION Path\` keyword form. This added \`VARIABLE SLASH attributePathV3\` as an alternative in \`dataSourceExprV3\` so the natural expression-like form now works: DATAGRID items (DataSource: \$currentObject/Module.Order_OrderLine) Both forms emit the same \"association\" data source type to the executor and writer. Documentation updated in create-page.md and master-detail-pages.md skills. Closes mendixlabs#198. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9b336b1 commit 9c1d144

6 files changed

Lines changed: 4173 additions & 4137 deletions

File tree

.claude/skills/mendix/create-page.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,8 @@ COLUMN colActions (Caption: 'Actions') {
342342
| `DataSource: $Variable` | Variable bound (requires DATAVIEW parent with entity) |
343343
| `DataSource: MICROFLOW Module.GetData()` | Microflow datasource |
344344
| `DataSource: SELECTION widgetName` | Listen to selection from another widget |
345+
| `DataSource: ASSOCIATION Path` | Retrieve by association from context (ByAssociation) |
346+
| `DataSource: $currentObject/Module.Assoc` | Sugar for `ASSOCIATION` — same semantics, reads more naturally |
345347

346348
**With WHERE and SORT BY (inline in DataSource):**
347349
```sql
@@ -804,7 +806,6 @@ The following features are NOT implemented in mxcli and require manual configura
804806

805807
| Feature | Workaround |
806808
|---------|------------|
807-
| `DataSource: ASSOCIATION` | Use `DATABASE` with WHERE constraint, or microflow datasource |
808809
| Nested dataviews filtering by parent | Use microflow datasource or configure in Studio Pro |
809810
| Complex conditional visibility | Configure visibility rules in Studio Pro |
810811
| Widget-level security | Configure access rules in Studio Pro |

.claude/skills/mendix/master-detail-pages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ LISTVIEW widgetName (DataSource: DATABASE Module.Entity, PageSize: 10) {
8686

8787
Used inside the detail form to show related/associated data.
8888

89-
**Note:** `DataSource: ASSOCIATION` is not yet fully implemented. Use `DATABASE` with a microflow datasource for related data.
89+
**Nested list by association:** Use `DataSource: $currentObject/Module.Assoc` (or the explicit `DataSource: ASSOCIATION Path` form) inside a parent DATAVIEW. Both forms produce the same BSON (ByAssociation data source). Example: `DATAGRID lines (DataSource: $currentObject/Order_OrderLine)` inside a `DATAVIEW dv (DataSource: DATABASE Order)`.
9090

9191
## Complete Example
9292

mdl/grammar/MDLParser.g4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2168,13 +2168,14 @@ attributeListV3
21682168

21692169
// V3 DataSource expressions
21702170
dataSourceExprV3
2171-
: VARIABLE // $ParamName
2171+
: VARIABLE SLASH attributePathV3 // $currentObject/Module.Assoc (ByAssociation — sugar for ASSOCIATION)
2172+
| VARIABLE // $ParamName
21722173
| DATABASE FROM? qualifiedName // DATABASE [FROM] Entity [WHERE ...] [SORT BY ...]
21732174
(WHERE (xpathConstraint (andOrXpath? xpathConstraint)* | expression))?
21742175
(SORT_BY sortColumn (COMMA sortColumn)*)?
21752176
| MICROFLOW qualifiedName microflowArgsV3? // MICROFLOW Module.Flow
21762177
| NANOFLOW qualifiedName microflowArgsV3? // NANOFLOW Module.Flow
2177-
| ASSOCIATION attributePathV3 // ASSOCIATION Path
2178+
| ASSOCIATION attributePathV3 // ASSOCIATION Path (explicit form)
21782179
| SELECTION IDENTIFIER // SELECTION widgetName
21792180
;
21802181

mdl/grammar/parser/MDLParser.interp

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)