Skip to content
Developerhome
X3

Reference properties

  Less than to read

When a table field has a Linked table column in the Table dictionary, a reference property is created for that link. It defines the foreign key used to link the field to another table.

For example, the FISCALYEAR table (FIY) contains the CPY field (Company) with Linked Table = COMPANY. This creates a reference property in the node definition for the node FiscalYear and produces the following code in the JavaScript node definition:

referenceJoins: {
    company: {
        code: 'company',
    },
},

[...]

__decorate([
    xtrem_core_1.decorators.referenceProperty({
        isPublished: true,
        isStored: true,
        columnName: 'CPY',
        columnType: 'string',
        node: () => sageX3System.nodes.Company,
    })
], FiscalYear.prototype, "company", void 0);

This code is all automatically generated.

It is possible to view how reference properties are bound to a node in the Binding dictionary function (GESAPINOD):

  1. Go to Node bindings and select your node.
  2. Go to Binding dictionary and in the Node properties section you will see the column Join type.
  3. The column contains Reference. This means it refers to another node.

In the following example, the fiscal year is defined in the node API_FISCALYEAR. In the Node properties grid in the Binding dictionary for node API_FISCALYEAR, the company property has a Join type set to Reference.

When that line is selected, the details of the reference are displayed in the Reference properties tab.

  • Target: Indicates the node targeted by this reference.
  • The grid defines the mapping between properties in the main node and the properties in the target node. This defines a de facto foreign key.

The documentation regarding Collections provides further insight into the creation of additional standalone references (0:1 or 1:1 collection).