Delphi-RAG-Lint

drag-lint help

Field repository: fields of a form in the IDE

Since: 1.54.0-alpha

Reads the datasets and grids of the form in the editor into the field repository, or writes persistent fields and grid columns back; checked first.

Read this when the fields of the form you have open should go to the field repository, or should come from it. Each command is a dry run first; a list shows every change old and new, blocked changes cannot be checked, and only the checked changes are written.

Where to click

  • RAD Studio main menu: drag-lint > Field Repository > Read Field Info from Dataset
    1. Open the form (and the project that has the field repository); select the dataset in the designer, or pick it from the list
    2. Choose drag-lint > Field Repository > Read Field Info from Dataset
    3. Check the changes you want and press Apply (repo read-dfm --dataset --select)
  • RAD Studio main menu: drag-lint > Field Repository > Read Field Info from All Datasets on Form
    1. Open the form
    2. Choose drag-lint > Field Repository > Read Field Info from All Datasets on Form
    3. Check the changes you want and press Apply (repo read-dfm --select)
  • RAD Studio main menu: drag-lint > Field Repository > Write Field Info into Dataset...
    1. Open the form; select the dataset in the designer, or pick it from the list
    2. Choose drag-lint > Field Repository > Write Field Info into Dataset...
    3. Check the fields the dataset should have and press Preview...
    4. Check the changes you want and press Apply (repo write-dfm --names --select); the open form is changed in the designer (not saved; File > Revert undoes it), or, when it cannot be, the .dfm is written and the form is reloaded
    5. The field list shows the lookup tier under the hint (fieldrepo.lookup.tier of drag-lint-project.json) and, for lookup fields, a Lookup source column from repo lookup-source: the status and holder, or the generated fallback; it is information, nothing is written from it
  • RAD Studio main menu: drag-lint > Field Repository > Copy Grid Columns to Grid...
    1. Choose drag-lint > Field Repository > Copy Grid Columns to Grid...
    2. Pick the grid view to copy from and the grid view to copy to, then everything or one event
    3. Check the changes you want in the list and press Apply (repo copy-grid --select); the form is reloaded
  • RAD Studio main menu: drag-lint > Field Repository > Read from Grid or Layout
    1. Open the form; select the grid (a TcxGridDBTableView or a TDBGrid) in the designer, or pick it from the list
    2. Choose drag-lint > Field Repository > Read from Grid or Layout
    3. Check the changes you want (columns, captions, widths, editors, events, unbound columns) and press Apply (repo read-grid --from --select)
  • RAD Studio main menu: drag-lint > Field Repository > Read from All Grids on This Form
    1. Open the form
    2. Choose drag-lint > Field Repository > Read from All Grids on This Form
    3. Check the changes you want and press Apply (repo read-grid --select)
  • RAD Studio main menu: drag-lint > Field Repository > Write to Grid or Layout...
    1. Open the form; select the grid in the designer, or pick it from the list
    2. Choose drag-lint > Field Repository > Write to Grid or Layout...
    3. Select the existing columns to compare in the designer (none selected: a list asks which; Cancel stops)
    4. In the diff dialog tick the columns to add and the properties to change (tabs All changes, By column, DFM text; a property change is unticked until you tick it) and press Write N (repo write-grid --to --columns --select); the form is reloaded
  • RAD Studio main menu: drag-lint > Field Repository > Generate Calculated-Field Handlers...
    1. Open the form (saved); select the dataset in the designer, or pick it from the list
    2. Choose drag-lint > Field Repository > Generate Calculated-Field Handlers...
    3. Read the dry-run summary and answer Yes (repo gen-calc --dfm --unit --dataset --apply); the OnCalcFields handler the form names gets one volatile region and the form is reloaded
  • RAD Studio main menu: drag-lint > Field Repository > Generate Grid Column Events...
    1. Open the form (saved); select the grid in the designer, or pick it from the list
    2. Choose drag-lint > Field Repository > Generate Grid Column Events...
    3. Read the dry-run summary and answer Yes (repo gen-events --dfm --unit --to --apply); handlers for the unassigned column events the repository has code for are created and assigned, and the form is reloaded
  • RAD Studio main menu: drag-lint > Field Repository > Lookup Sources of This Form...
    1. Open the form (saved)
    2. Choose drag-lint > Field Repository > Lookup Sources of This Form...
    3. Read the report (repo lookup-source --form): per lookup field the dataset that holds the lookup table unfiltered (proved, accepted or ranked), the generated fallback, or blocked with the reason; nothing is written

Details

The Field Repository submenu of the drag-lint menu has nine commands for the form in the editor. The active project names the repository (fieldRepository); it must be schema 3 or later. Nothing is written before you press Apply.

CommandWhat it doesCLI
Read Field Info from Datasetreads one dataset into the repositoryrepo read-dfm --dataset
Read Field Info from All Datasets on Formreads every dataset and grid view of the formrepo read-dfm
Write Field Info into Dataset...writes persistent fields from the repository into a dataset, and removes themrepo write-dfm --names
Copy Grid Columns to Grid...copies the events of one grid view, its columns and their events to another view of the same formrepo copy-grid
Read from Grid or Layoutreads the columns of one grid view (TcxGridDBTableView or TDBGrid), their captions, widths, editors, events and unbound columns into the repositoryrepo read-grid --from
Read from All Grids on This Formthe same for every grid of the formrepo read-grid
Write to Grid or Layout...adds the columns the repository has for the table and the grid lacks to a TcxGridDBTableView or TDBGrid; the columns selected in the designer (or picked from a list) are also compared with the repository and every property that differs is offered, unticked (diff dialog, 1.62)repo write-grid --to
Generate Calculated-Field Handlers...writes the calculation code of the calculated and internal-calc fields of a dataset into the OnCalcFields handler the form names (one volatile region, rewritten on every run)repo gen-calc
Generate Grid Column Events...creates and assigns the column event handlers (OnGetDisplayText, OnCustomDrawCell and the layout events) the repository has code for, in a grid view; an event already assigned is reported, never replacedrepo gen-events --to
Lookup Sources of This Form...reports, for each lookup field of the saved form, the dataset that holds the lookup table unfiltered (proved, accepted or ranked), the generated fallback, or blocked with the reason; writes nothingrepo lookup-source --form

The form. It is read from disk: unsaved changes are saved first, after a question. The dataset is the one selected in the designer, or the only one of the form; otherwise a list asks.

Write Field Info into Dataset. The list has every field the repository has for the table of the dataset. Checked at first: the persistent fields of the form.

  • Checking a calculated, internal-calc or aggregate field adds the fields its code names, a lookup adds its key.
  • Unchecking a field removes nothing else. A field that a checked field needs stays, and the status line names that field.
  • A graphical field is a grid column, a field of another table and a field the repository does not know are listed and cannot be changed: they stay as they are.
  • An empty selection is refused. Delete all persistent fields in the form designer instead.
  • A dataset without a table (a join, a memory table, SQL built in code) has no list; the message says why.

The changes. Each row is one change with its old and new value. It starts checked as the engine proposes it: a removed field, a hidden field and contradicting values are unchecked. A blocked change shows its reason and cannot be checked. Warnings are below the list. Enter does not write; Apply does.

Between preview and write. write-dfm takes the plan id of the preview: when the form, its unit or the repository changed, nothing is written. For a read the dry run is repeated and compared. A form edited after the preview is neither written nor read. After a write the form is reloaded; the old files are beside it (*.before-write-dfm-*). A form that was edited while the write ran is not reloaded: the message says written to disk, NOT reloaded: your editor buffer is older. After a failed run that changed a file you are asked whether to reload.

Grids. The grid is the one selected in the designer, the only one of the form, or the one a list asks for. Read and write are dry runs with the same list of changes and the same plan id check as above; a write reloads the form. Unbound columns (drawn or formatted by events) are stored as entries of the table and offered again by Write to Grid or Layout. Write to Grid or Layout (1.62) compares the existing columns you selected in the designer (columns of a TDBGrid are not designer components: a list asks) with the repository: the dry run is run with --columns, and the apply run passes the same list, because the selection is part of the plan id. The diff dialog shows the same changes three ways: All changes, By column, and DFM text (before / after per changed object). Added columns are ticked, property changes are not; a change that needs another (an editor class and its lines) ticks it with it, and a blocked change cannot be ticked. Cancel in the list that asks for columns stops the command.

Applied in the open form. Write Field Info into Dataset changes the form open in the designer in the IDE process: the fields appear at once, the form is marked modified and is NOT saved; File > Revert undoes it. When that is not possible (the form is not open in the designer, or a step has no designer form) the .dfm is written and the form reloaded as before; the message says which happened. The two generate commands write the .dfm and the unit on disk (dry run, a question, then one run) and reload the form; a form with unsaved changes is refused.

The calculation code of an added field is not written into the unit: see generated handlers.

repo read-dfm --dataset <Name> --json has what the dialog shows: persistent (field, component, class, kind, table, column) and tableFields (field, kind, sourceKey, body).

Tiers

The field dialog of Write Field Info into Dataset... has a tier row and a source column for lookup fields. Under the hint: Lookup tier: 1 (a generated TFDTable), 2 (a generated TFDQuery), 3 (the generated lookup layer), not set or unknown (the engine did not answer). The tier is the project setting fieldrepo.lookup.tier of drag-lint-project.json (Options > drag-lint > General > Field Repository shows the key); see repo lookup-source for what each tier generates.

The column Lookup source is filled for the lookup fields of the dataset: PROVED / ACCEPTED / RANKED and the dataset that holds the lookup table unfiltered, or BLOCKED and the generated fallback. It is one quiet repo lookup-source --form --json run on the saved form before the dialog opens; without an index, without the verb or without lookups the column stays blank and nothing else changes. Checking a row never writes the source: it is information.


All features | CLI reference | IDE menus