Skip to content

Commit ccd8f17

Browse files
akoclaude
andcommitted
Add mxcli check validation step to OQL/VIEW entity skill
The write-oql-queries skill was missing a validation step that all other skills (write-microflows, alter-page, migrations) include. This caused users to skip validation and go straight to exec, missing type mismatches like Long vs Integer for count() that produce CE6770 at build time. Added mxcli check --references to: - Step-by-step process (new Step 8) - OQL → VIEW ENTITY workflow (step 4) - Summary checklist Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ab3fe2a commit ccd8f17

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.claude/skills/mendix/write-oql-queries.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,13 @@ LEFT JOIN Shop.Product_Category/Shop.Category AS cat
502502
- Ensure ALL SELECT columns have explicit AS aliases
503503
- Aliases must match entity attribute names exactly
504504

505-
### Step 8: Final Check
505+
### Step 8: Validate Before Executing
506+
```bash
507+
mxcli check view.mdl -p app.mpr --references
508+
```
509+
This catches type mismatches (e.g., declaring `Long` for a `count()` column that returns `Integer`), missing module references, and OQL syntax errors — before they become MxBuild errors like CE6770 ("View Entity is out of sync with the OQL Query").
510+
511+
### Step 9: Final Check
506512
- Remove any ORDER BY, LIMIT, or OFFSET clauses
507513
- These should be handled by the UI component or microflow
508514

@@ -665,7 +671,8 @@ The app must be running first: `mxcli docker run -p app.mpr --wait`
665671
1. **Write and test interactively**: `mxcli oql -p app.mpr "SELECT ..."`
666672
2. **Iterate** until the query returns expected results
667673
3. **Embed** in a VIEW ENTITY with matching column aliases and attribute types
668-
4. **Apply and rebuild**: `mxcli exec view.mdl -p app.mpr && mxcli docker run -p app.mpr --fresh --wait`
674+
4. **Validate before executing**: `mxcli check view.mdl -p app.mpr --references` to catch type mismatches (e.g., `Long` vs `Integer` for `count()`)
675+
5. **Apply and rebuild**: `mxcli exec view.mdl -p app.mpr && mxcli docker run -p app.mpr --fresh --wait`
669676

670677
## Integration with MDL Linter
671678

@@ -714,5 +721,6 @@ When writing OQL queries for VIEW entities, always verify:
714721
- [ ] Association navigation uses correct syntax: `Entity_Assoc/Target AS alias`
715722
- [ ] JOIN ON clauses use comparison operators: `ON a.Field = b.Field`
716723
- [ ] Subqueries are enclosed in parentheses and return appropriate values
724+
- [ ] **Validate before executing**: Run `mxcli check script.mdl -p app.mpr --references` to catch type mismatches
717725

718726
Following these rules ensures your OQL queries will parse and execute correctly in Mendix runtime.

0 commit comments

Comments
 (0)