ZuloOne
English
Sign in
Menu

TablePart — table part

Updated

What it is#

Lines of a document (or another aggregate) — an independent TP_<Name> table attached to a document through a tableParts record in <Document>.object.json (see Document). One table part type can be used by several documents (reusable table part), although one-to-one is more common.

JSON envelope#

<Name>.json (table part type) + Events/<Name>EventHandler.script.json/.cs:

{
  "kind": "TablePartType",
  "object": {
    "className": "GoodsIssueLinesTablePartRow",
    "caption": { "en": "Lines", "ru": "Строки" },
    "tableName": "TP_GoodsIssueLines",
    "metaId": "<GUID TablePartType>", "name": "GoodsIssueLines", "modelId": "<GUID Model>"
  },
  "properties": [
    {
      "tablePartTypeMetaId": "<GUID TablePartType>",
      "fieldName": "Item",
      "edtMetaId": "<GUID EDT Reference>",
      "isReference": true, "referenceKind": "Dictionary",
      "referenceMetaId": "<GUID Item Dictionary>", "referenceName": "Item",
      "isRequired": true, "isVisible": true, "displayOrder": 1,
      "caption": { "en": "Item", "ru": "Товар" },
      "metaId": "<GUID Prop>", "name": "Item", "modelId": "<GUID Model>"
    },
    {
      "tablePartTypeMetaId": "<GUID TablePartType>",
      "fieldName": "Quantity",
      "edtMetaId": "<GUID EDT Qty>",
      "unitFieldName": "Unit",
      "baseUnitPath": "Item.UnitOfMeasure",
      "normalizedFieldName": "BaseQuantity",
      "isRequired": true, "displayOrder": 2,
      "caption": { "en": "Quantity", "ru": "Количество" },
      "metaId": "<GUID Prop>", "name": "Quantity", "modelId": "<GUID Model>"
    }
  ]
}

lookupFilter on a reference column narrows its picker by the document HEADER's fields: "Customer=Customer" offers only records whose Customer equals the header's Customer (target field = form field pairs, comma-separated; an empty header field does not narrow). Choice only — see document.md.

unitFieldName/baseUnitPath/normalizedFieldName is the unit-of-measure field trio: the entered quantity (Quantity in the unit from unitFieldName) is converted by the normalizer into normalizedFieldName (usually BaseQuantity, isVisible: false, with developerComments explicitly saying "filled by the platform") along the baseUnitPath to the item's base unit — on every line record, the script already has this column calculated. An optional scalar in a table part generates a nullable type (decimal?/DateTime?), unlike document-header/dictionary fields.

C# base#

<Name>EventHandler : TypedTablePartEventHandler<<Name>TablePartRow> — the base is declared manually; the parent document is available through Owner<Document>(context).

Events / Chain of Command#

The same life-cycle hook set as for Dictionary/Document (line creation, save, delete, field validation), but bound to a table part line rather than to the owner record. The handler fires when a line is added/edited in the table part grid on the document form.

Example#

GoodsIssueLines — the table part of the GoodsIssue document: Item+Quantity+Unit+BaseQuantity(normalized)+FromCell.

Was this page helpful?