Collections
Less than to read
A collection is a relationship between two datasets.
You can define a collection in the Data models function (GESAWM) by linking a table relationship to a property name and a node.
In the following example, the Sales order price table is linked as a collection into the main Sales order header table with a property called salesOrderLines:
Fields
- Type: Specifies the relationship between the main table and the linked table.
- 0:n or 1:n: A record in the main table links to many records in the linked table. This is a collection.
- 0:1 or 1:1: This is used when a reference (foreign key) is needed but is not defined in the Table dictionary. In that case, developers can add a link between the two tables in the Data models function with the 0:1 or 1:1 relationship option. This is a standalone reference.
- Key: Indicates the index used in the linked table.
- Link expression: Maps the field in the main table to an index in the linked table indicated in the Key column.
- Node name (API): Name of the node that represents the linked table.
- Property name (API): Name of the property that represents the collection of nodes or the reference when it’s a standalone reference. By convention, collection names should end with an "s". For example, salesOrderLines.
- Package name (API): Specifies a different package for the property/collection to be delivered in. It is optional. If a package name is entered, the collection property is declared in a node extension in the specified package. If the field is left empty, the collection property is declared in the same package as the main node.
- Mutable reference or collection (API) checkbox:
- If checked, the collection property is included in the node’s mutation. This means the collection property is included in the payload sent to X3. Please note that defining a reference as mutable means that you expect to update, create or delete the reference record. For example, defining the product reference as mutable on a node allows you to create or update a product in the node Product.
- If unchecked, the collection properties will not be mutable.
A new left list has been added to identify data models related to nodes with collections:
Note: If a collection or standalone reference is defined with a linked table that is not a valid node, the main node will not be generated at all. Linked nodes must have a data model record with a node name and a package name and they must have properties defined for their primary keys.