User manual

Table Of Contents
Chapter 4
|
Working with related tables and files 97
You create a relational database by defining a relationship between two fields, called match fields. These fields
can be in different tables or they can be in the same table (a self-join). You are able to access related data when
the value in the match field(s) on one side of the relationship compares successfully with a value in the match
field(s) on the other side of the relationship, according to the criteria you establish in the relationship.
After you have created a relationship, you can use fields from the related table just as you would use any
fields in the current table: to display data on a layout, as part of a calculation formula, in a script, as a match
field for another relationship, and so on. You can work with the data in the related fields in all modes (if you
have access privileges) when you work with records in the current table.
When you display related data in a portal, values from all related records are displayed. When the related
field isn’t in a portal, the value from the first related record is displayed.
For more information about relationships, see Help.
Relational database terminology
Before you begin working with relational databases and lookups, you should understand the following
terms. These terms are explained in the sections that follow.
Te r m Description
Current table For relational databases, the table that you are currently working in.
For lookups, the table that the data is copied to.
External table A table outside of the current file, in another file.
Lookup target field (for
lookups only)
The field in a table that you want data copied to during a lookup.
Lookup source field
(for lookups only)
The field in the related table that contains the data you want copied during a lookup.
Match field A field in the current table and a field in a related table that each contains values used to access matching
records. (A match field is sometimes called a key field.) For each relationship, you select one or more
match fields in each table.
For relational databases, values in match fields must match each other in some way for a relationship to
be established between the files. See
About match fields for relationships” on page 98.
For lookups, values in match fields do not have to be equal to match.
Portal A layout object that displays records from related tables. Portals display data from related fields in rows,
one record in each row.
Related field A field in one table that is related to a field in another table (or to a different field within the same table).
If a relationship has been created between two tables (even through another table), data in fields in one
table can be accessed from the other table.
Related record A record in the related table whose match field (according to the relationship used) contains a value that
matches the value in the match field of another table.
Related table For relational databases, the table that contains the data you want to access and work with in the current table.
For lookups, the table that contains the data to copy.
A table can be related to itself. This is called a self-join.
Relational operators In the relationships graph, the symbols that define the match criteria between one or more pairs of fields
in two tables. These include: equal (=), not equal (), greater than (>), greater than or equal to (), less
than (<), less than or equal to (), and all rows, or cartesian product (X).
Relationship Relationships provide access to data from one table to another. Relationships can join one record in one table
to one record in another table, one record to many other records, or all records in one table to all records in
another table, depending on the criteria you specify when you create the relationship in the relationships graph.
(A relationship is sometimes called a link or a join expression.)