Database Reference
In-Depth Information
a direct relationship between the Expenses and Line Item tables, how do you know which
table to make a new occurrence for? To answer that question, ask yourself this one: What
layout do I want to view the related data from, and which table has the information I need to
see? Here are the three possible scenarios:
▪ If you want to display Expense data on the Line Item layout, then the Line Item table will
be the parent and the Expenses table will be the child. You could use Line Item::Line
Item ID as one key, but you'd need to create a Line Item ID in the Expenses table.
▪ If, on the other hand, you want to display Line Item data on the Expenses layout, then the
opposite is true. The Expense table would be the parent, and the Line Item table would
be the child. You'd hook up the existing Expenses::Expenses ID field with a newly cre-
ated Expenses ID in the Line Item table.
▪ In some instances, you might want to display data from both layouts. In that case, you'll
need two new TOs and two new key fields.
All three scenarios are valid depending on what you're trying to achieve. In this case, you
want to display Line Item data on the Expenses layout, so you'll create a Line Item ID field
in the Expenses table. In the Invoices database, choose File→Manage Database, switch to
the Fields tab and then select the Expenses table. Create a new number field called Line Item
ID and then click OK when you're done. You'll use this new field to relate the Expenses
table to Line Items.
Adding a Table Occurrence
Since you want to display line item details on the Expenses layout, you'll create a new TO
for the Line Items table. And you need to make a new relationship between the Expenses TO
and the Line Items TO by using your new Expenses::Line Items ID key field. Figure 14-7
shows what that Relationships graph looks like with the new Line Items TO. With the new
graph in mind, here's how to create the new Line Item TO in your database:
1. On the Relationships tab of the Manage Database dialog box, click the Add Table
Occurrence button (on the bottom left) .
The Specify Table dialog box appears ( Figure 14-8 ).
2. Select the Line Items table from the list and then, in the Name box, type Ex-
penses_Line Items .
You want a descriptive name so you can pick it out of a lineup later.
3. Click OK .
FileMaker adds the new table occurrence to the graph and selects it for you.
Search WWH ::




Custom Search