Skip to content

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

  1. Right-click the Models node in the project tree
  2. Select New Model
  3. Enter the model name (should match the database table name)
  4. The model opens in the editor with a basic structure
  5. 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

  1. Select Tools > Model Wizard (or right-click Models > Import from Database)
  2. Choose the database connection (as configured in Config.yaml)
  3. The wizard queries the database catalog and displays available tables
  4. Select the tables you want to import
  5. Click Import — KIDEx generates a .yaml file for each selected table

The wizard imports:

  • Table name → ModelName
  • Column names, data types, and sizes → Fields
  • Primary keys → primary key modifier
  • NOT NULL constraints → not null modifier
  • Foreign keys → Reference() fields pointing to the referenced model
  • Display labels are auto-generated from field names (e.g. EMPLOYEE_NAMEEmployee 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:

PropertyTypeDescription
DisplayLabelStringLabel shown in forms and grids (auto-generated if not set)
DisplayWidthIntegerWidth in characters for forms and grid columns
IsRequiredBooleanWhether the field is mandatory
IsVisibleBooleanWhether the field appears in auto-generated views
IsReadOnlyBooleanWhether the field is editable
IsPasswordBooleanRenders the field as a masked password input
AllowedValuesSubnodeStatic list of valid values (rendered as a dropdown)
DefaultValueStringDefault value for new records (supports macros like %COMPACT_GUID%)
ExpressionStringSQL expression for computed/calculated fields
HintStringTooltip text shown when hovering over the field
RulesSubnodeBusiness 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):

yaml
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:

yaml
DetailReferences:
  Phases:
    Model: PHASE
    ReferenceField: PROJECT

KIDEx 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.

Released under Apache License, Version 2.0.