Relationships
Records rarely stand alone: a task waits on a part, a print job belongs to a build, a component sits in a machine. Cobblr links records a few different ways, and which one fits depends on what the link is for.
Relation fields
A relation field points one record at another. It is a custom field whose type
is relation and whose definition names the target kind. The stored value is the
target record's id; at read time Cobblr looks the target up and injects a
<name>_label alongside it, so a list row or detail panel shows the target's name
rather than a raw id. The link is read-only display in that direction: the stored
id is what you set, and the label is derived.
Use a relation field when a record should carry a pointer to one specific other record, and you want that pointer to show up as a proper linked name.
Pairings and traversal
Under relation fields sits a more general link between two records, a pairing,
which is directional (it has an "in" and an "out" side) and carries a relationship
kind. Pairings are what a wire walks
when its target is an object rather than self: from the record that triggered
the wire, follow a named relationship in a direction to reach the related records,
and run the action on each. So "when this order is received, update the parts it
contains" is one wire walking one relationship.
Placement and tags
Two of the links a record can have are their own foundational mechanisms rather than fields you add:
- Placement answers "what is this inside." It is the containment primitive behind locations; a part in a machine and an item in a bin use the same mechanism. See Locations and tags.
- Tags answer "what does this belong with." A tag groups records across modules without any of them pointing at each other.
Choosing among them
A relation field is a named pointer at one record. A pairing is the directional link a wire can traverse to act across records. Placement is physical containment. A tag is a loose, cross-cutting group. Reach for the one that matches the shape of the connection you are recording.