Where a field is used
Tells per field name whether the project index finds it in a DFM control, a grid column, a lookup or code; the IDE Select Fields dialog uses it.
Read this when you want to know which fields of a table are really used before you edit, rename or drop them. drag-lint repo field-usage --fields "ID,QTY" --json answers from the project index, per field, with the places it is used: dfm, grid, lookup, code. A field nothing uses is left out. The IDE Select Fields dialog runs it to show the icons. The Select Fields dialog shows the answer as a 16-icon strip in a Used in column (dfm, grid, lookup and code add up to one icon).
How to run it
drag-lint repo field-usage --fields "A,B,C" [--json] [--db <index> | --project <project file>]
Full flag list: repo in the CLI reference.
Flags
| Flag | Argument | Meaning | Default |
|---|---|---|---|
--fields | A,B,C | ||
--json | |||
--db | <index> | ||
--project | <project file> |
Where to click
No IDE surface: this feature runs from the CLI (see How to run it).
Details
drag-lint repo field-usage --fields "A,B,C" [--json] (--db <project index> | --project <project file>)
Asks the PROJECT index (not the field repository) where each named field is used, and answers one line:
{"usage":[{"field":"ID","kinds":["dfm","grid","lookup","code"]}]}
| Kind | Found when |
|---|---|
dfm | a DFM control has DataField = the field |
grid | a grid column (*Column* object) has FieldName or DataBinding.FieldName = the field |
lookup | KeyField, ListField, LookupKeyFields, LookupResultField, Properties.KeyFieldNames or Properties.ListFieldNames names the field (one name or a ; list) |
code | the index holds a literal-name field access of it (FieldByName('ID'), Fields-style accesses) |
Names are compared without case and without blanks; the answer upper-cases them and folds duplicates. Kinds come in the
order dfm, grid, lookup, code. A field with no use is omitted, so {"usage":[]} means nothing is used. Without --json
each used field is one line, ID: dfm, grid, code.
The index is --db when given, else the one the manifest names for --project. Reindex after editing a DFM or unit,
or the answer is the old one. An index made before the DFM tables existed has no dfm / grid / lookup answer, only
code.
| Exit | Meaning |
|---|---|
| 0 | answered |
| 1 | no project index, or it cannot be opened |
| 2 | no --fields |
The IDE plugin (Select Fields) runs this verb and reads the JSON above; while the verb is missing it shows blank icons.
Tests: tests\autotest\run_v156_FUSAGE.ps1 (fixture project; a use removed drops exactly its kind).