一键导入
cheatsheet-variables
MDL Variable Cheatsheet — declaration syntax for all types, key rules, common mistakes, special values, parameter vs variable, and scope
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
MDL Variable Cheatsheet — declaration syntax for all types, key rules, common mistakes, special values, parameter vs variable, and scope
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Mendix MDL authoring, project navigation, and Docker app lifecycle — entities, microflows, pages, security, navigation, OQL, REST, testing, linting, and migration. Load when working in any Mendix codebase.
MDL Agent Documents — CREATE MODEL, CREATE KNOWLEDGE BASE, CREATE CONSUMED MCP SERVICE, CREATE AGENT syntax and calling agents from microflows
ALTER PAGE / ALTER SNIPPET — SET, INSERT, DROP, REPLACE widget operations on existing pages and snippets
Migration Assessment — structured investigation of non-Mendix projects for migration planning across technology stack, data model, business logic, UI, integrations, and security
Assess Mendix Project Quality — automated linting, catalog queries, naming conventions, security, maintainability, performance, and architecture review with scored report
Browse Integration Services and Contracts — SHOW/DESCRIBE OData, REST, business event, and database connection services; query MDL CATALOG integration tables; import external entities
| name | cheatsheet-variables |
| description | MDL Variable Cheatsheet — declaration syntax for all types, key rules, common mistakes, special values, parameter vs variable, and scope |
| compatibility | opencode |
MDL variable reference — quick lookup for variable declarations, rules, and scope in microflows.
<declaration_syntax>
| Type | Syntax | Example |
|---|---|---|
| String | declare $name string = 'value'; | declare $message string = ''; |
| Integer | declare $name integer = 0; | declare $count integer = 0; |
| Boolean | declare $name boolean = true; | declare $IsValid boolean = true; |
| Decimal | declare $name decimal = 0.0; | declare $Amount decimal = 0; |
| DateTime | declare $name datetime = [%CurrentDateTime%]; | declare $Now datetime = [%CurrentDateTime%]; |
| Entity | declare $name as Module.Entity; | declare $Customer as Sales.Customer; |
| List | declare $name list of Module.Entity = empty; | declare $Orders list of Sales.Order = empty; |
</declaration_syntax>
<key_rules>
declare $var type = value; (initialization required)declare $var as Module.Entity; (use AS keyword, no initialization)declare $var list of Module.Entity = empty;</key_rules>
<common_mistakes>
-- WRONG: Missing AS keyword
declare $Product Module.Product = empty;
-- CORRECT: Use AS for entity types
declare $Product as Module.Product;
-- WRONG: Variable not declared
if $value > 10 then
set $message = 'High'; -- ERROR!
end if;
-- CORRECT: Declare first
declare $message string = '';
if $value > 10 then
set $message = 'High';
end if;
-- WRONG: Missing 'of' keyword
declare $Items list Module.Item = empty;
-- CORRECT: Use 'list of'
declare $Items list of Module.Item = empty;
</common_mistakes>
<special_values>
| Value | Usage |
|---|---|
empty | Null/empty value for any type |
[%CurrentDateTime%] | Current date and time |
[%CurrentUser%] | Currently logged in user object |
true / false | Boolean literals |
</special_values>
<parameter_vs_variable>
create microflow Module.Example (
$Input: string, -- Parameter: auto-declared
$entity: Module.Customer -- Parameter: auto-declared
)
returns boolean
begin
-- Parameters $Input and $Entity are already available
declare $Result boolean = true; -- Local variable: must declare
declare $Temp as Module.Order; -- Local entity: must declare
return $Result;
end;
/
</parameter_vs_variable>
<variable_scope>
loop $item in $ItemList
begin
-- $item is available here (derived from list type)
set $count = $count + 1;
end loop;
-- $item is NOT available here
</variable_scope>
<output_rules>Output MDL code only in code blocks. Keep explanations concise.</output_rules>