Model Editor
The Model Editor is the primary tool for defining and maintaining the data models that form the foundation of every Kittox application. Each model maps to a database table and defines fields, data types, references (foreign keys), detail references (one-to-many), and business rules.
Editor layout
When you double-click a model in the project tree, KIDEx opens it in the editor panel:
The editor has two main areas:
- Tree panel (left) — the model structure:
ModelName,Fields,DetailReferences,Rules, etc. - Property panel (right) — context-sensitive property editor for the selected node. Changes are immediately reflected in the underlying YAML.
Creating a model manually
- Right-click the Models node in the project tree
- Select New Model
- Enter the model name (should match the database table name)
- The model opens in the editor with a basic structure
- Right-click the Fields node to add fields one by one
Each field requires at minimum a name and a data type. Use the right-click context menu to see all available field properties — the menu is built dynamically from RTTI attributes on TKModelField.
Database reverse engineering
The Model Wizard imports table structures directly from a database and generates Model YAML files automatically.
How to use the wizard
- Select Tools > Model Wizard (or right-click Models > Import from Database)
- Choose the database connection (as configured in
Config.yaml) - The wizard queries the database catalog and displays available tables
- Select the tables you want to import
- Click Import — KIDEx generates a
.yamlfile for each selected table
The wizard imports:
- Table name →
ModelName - Column names, data types, and sizes →
Fields - Primary keys →
primary keymodifier - NOT NULL constraints →
not nullmodifier - Foreign keys →
Reference()fields pointing to the referenced model - Display labels are auto-generated from field names (e.g.
EMPLOYEE_NAME→Employee Name)
Updating existing models
If a model already exists, the wizard can update it with new columns from the database while preserving your custom properties (DisplayWidth, IsRequired, AllowedValues, Rules, etc.).
Field properties
The most commonly used field properties:
| Property | Type | Description |
|---|---|---|
DisplayLabel | String | Label shown in forms and grids (auto-generated if not set) |
DisplayWidth | Integer | Width in characters for forms and grid columns |
IsRequired | Boolean | Whether the field is mandatory |
IsVisible | Boolean | Whether the field appears in auto-generated views |
IsReadOnly | Boolean | Whether the field is editable |
IsPassword | Boolean | Renders the field as a masked password input |
AllowedValues | Subnode | Static list of valid values (rendered as a dropdown) |
DefaultValue | String | Default value for new records (supports macros like %COMPACT_GUID%) |
Expression | String | SQL expression for computed/calculated fields |
Hint | String | Tooltip text shown when hovering over the field |
Rules | Subnode | Business rules applied to this field |
For the complete list of properties, right-click a field in KIDEx — the context menu shows all available properties with descriptions, built from RTTI attributes.
Reference fields
Reference fields define foreign key relationships. In the model tree, a reference field has child nodes for the FK column(s):
EMPLOYEE: Reference(EMPLOYEE) not null
Fields:
EMPLOYEE_ID:The context menu for reference fields includes properties specific to the referenced model, such as IsLarge (which switches from a dropdown to a lookup dialog in forms).
Detail references
Detail references define one-to-many relationships. They appear under the DetailReferences node:
DetailReferences:
Phases:
Model: PHASE
ReferenceField: PROJECTKIDEx uses these to generate detail tabs in form views automatically.
Model validation
KIDEx validates models when you save or when you explicitly run Tools > Validate Models. The validator checks for:
- Missing primary key fields
- References to non-existent models
- Invalid data type specifications
- Duplicate field names
- Circular reference chains
Validation errors and warnings appear in the log panel at the bottom of the KIDEx window.
