Skip to main content

Relations

Relations on views define how the view connects to other tables or views. They serve the same purposes as table relations — enabling automatic joins in forms, lookups, and queries, and documenting the referential structure of the data model. The key difference is that view relations are defined on a read-only object, so delete actions are not applicable.

A view relation consists of the AxViewRelation object and one or more constraints that define the join conditions. Constraints come in three types, plus a foreign-key variant of the relation itself.


Constraint Types

Field Constraint (AxViewRelationConstraintField)

Joins a field on the view to a field on the related table. This is the most common constraint type — equivalent to ViewField = RelatedTable.RelatedField.

Fixed Constraint (AxViewRelationConstraintFixed)

Constrains a field on the current view to a fixed integer value. Used when the relationship is valid only for a specific enum value or status. Equivalent to ViewField = <literal>.

Constrains a field on the related table to a fixed integer value. Equivalent to RelatedTable.RelatedField = <literal>.

Foreign Key Relation (AxViewRelationForeignKey)

A specialised relation variant that references an index on the related table to define the join. Instead of listing individual field constraints, it points to the index, and the constraint fields are derived from the index key columns.


Relationship Types

The RelationshipType property classifies the nature of the connection:

TypeValueDescription
NotSpecified0No classification. Avoid — always set a specific type.
Association1A general reference. The related table exists independently.
Composition2The child cannot exist without the parent.
Link3A navigational relationship for form linking.
Specialization4The current view is a specialised form of the related table.
Aggregation5Similar to composition but the child can logically exist independently.

Cardinality

Two properties define the multiplicity:

  • Cardinality — how many records on the view side participate.
  • RelatedTableCardinality — how many records on the related table side.

Cardinality Values

ValueNameMeaning
0NotSpecifiedNot set.
1ZeroOneZero or one record.
2ExactlyOneExactly one record (mandatory).
3ZeroMoreZero or more records.
4OneMoreOne or more records.

RelatedTableCardinality Values

ValueNameMeaning
0NotSpecifiedNot set.
1ZeroOneThe related record may or may not exist.
2ExactlyOneThe related record must exist.

Properties

18/18 properties
PropertyDisplay NameTypeDescription
RelationAxViewRelation
NameNameStringThe name of the relation.
TagsTagsStringTags for this element separated by semicolon.
RelatedTableRelated TableStringName of the related table or view.
RelatedTableCardinalityRelated Table CardinalityRelatedTableCardinalityCardinality on the related table side. Values: NotSpecified (0), ZeroOne (1), ExactlyOne (2).
CardinalityCardinalityCardinalityCardinality on the view side. Values: NotSpecified (0), ZeroOne (1), ExactlyOne (2), ZeroMore (3), OneMore (4).
RelationshipTypeRelationship TypeRelationshipTypeType of relationship. Values: NotSpecified (0), Association (1), Composition (2), Link (3), Specialization (4), Aggregation (5).
UseDefaultRoleNamesUse Default Role NamesNoYesWhether to auto-generate role names from the table names. Values: No (0), Yes (1).
RelatedTableRoleRelated Table RoleStringRole name for the related table in the relationship.
RoleRoleStringRole name for the current view in the relationship.
Foreign Key RelationAxViewRelationForeignKey
IndexIndexStringThe index on the related table that defines the foreign key.
ConstraintAxViewRelationConstraint
NameNameStringThe name of the constraint.
TagsTagsStringTags for this element separated by semicolon.
Field ConstraintAxViewRelationConstraintField
FieldFieldStringField on the current view used in the join.
RelatedFieldRelated FieldStringField on the related table used in the join.
Fixed ConstraintAxViewRelationConstraintFixed
FieldFieldStringField on the current view constrained to a fixed value.
ValueValueInt32The fixed integer value for the constraint.
Related Fixed ConstraintAxViewRelationConstraintRelatedFixed
RelatedFieldRelated FieldStringField on the related table constrained to a fixed value.
ValueValueInt32The fixed integer value for the constraint.