A referential constraint records that a column of one table refers to a row of another table, such as the application of a table. The constraints from a table are listed under the table as "Referential Constraints". The referential constraint of the table of banks: ![[20261004-studio-referential-constraints.png]] A referential constraint is created in the database as a foreign key, with an index on the referring column. It also tells the [[Invantive Studio/Repository/Concepts/Business Object|business objects]] which tables to join and gives screens the related rows to show on a tab. The role labels name the relation as it is read from each side. ## Fields The details of a referential constraint show these fields: - "Name": Name of the referential constraint. - "Role Code": Code of the role. - "Sort Order": Numeric value that determines the ordering of the records in this table in a drop-down box. - "From Application Code": Code of the application of the referring table. - "From Table Code": Code of the referring table. - "From Table Column Name": Name of the referring column. - "From Role Label": Label of the role on the source table, always plural. - "To Application Code": Code of the application of the referred table. - "To Table Code": Code of the referred table. - "To Table Column Name": Name of the referred column. - "To Role Label": Label of the role on the target table, always singular. - "Create": Whether the referential constraint will be created. - "Display": Whether the constraint will be shown. - "On Delete Category": What should happen to the referring rows when the referred row is deleted; recorded in the repository, not applied by the generation in release 27.0. - "Documentation": Documentation on the referential constraint. Up to and including release 27.0 these fields read "Application Code", "Table Code", "Table Column Role From Name" and "Role Label from" for the referring side, and "Application Code", "Table Code", "Table Column Role To Name" and "Role Label to" for the referred side. ## Tabs The summary window of a referential constraint shows its related rows on these tabs: - [[Invantive Studio/Repository/Applications/Table Columns|From Table Column]] - [[Invantive Studio/Repository/Applications/Table Columns|To Table Column]] Up to and including release 27.0 the tabs read "Table Column Role From" and "Table Column Role To".