You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
Copy file name to clipboardExpand all lines: .claude/skills/mendix/write-oql-queries.md
+10-2Lines changed: 10 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -502,7 +502,13 @@ LEFT JOIN Shop.Product_Category/Shop.Category AS cat
502
502
- Ensure ALL SELECT columns have explicit AS aliases
503
503
- Aliases must match entity attribute names exactly
504
504
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
506
512
- Remove any ORDER BY, LIMIT, or OFFSET clauses
507
513
- These should be handled by the UI component or microflow
508
514
@@ -665,7 +671,8 @@ The app must be running first: `mxcli docker run -p app.mpr --wait`
665
671
1.**Write and test interactively**: `mxcli oql -p app.mpr "SELECT ..."`
666
672
2.**Iterate** until the query returns expected results
667
673
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`
669
676
670
677
## Integration with MDL Linter
671
678
@@ -714,5 +721,6 @@ When writing OQL queries for VIEW entities, always verify:
714
721
-[ ] Association navigation uses correct syntax: `Entity_Assoc/Target AS alias`
715
722
-[ ] JOIN ON clauses use comparison operators: `ON a.Field = b.Field`
716
723
-[ ] 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
717
725
718
726
Following these rules ensures your OQL queries will parse and execute correctly in Mendix runtime.
0 commit comments