Database Reference
In-Depth Information
FREQUENTLY ASKED QUESTION: GLOBALS AND RELATIONSHIPS
I don't get it. I thought relationships were supposed to hook different records together, but a global
field has the same value throughout a table and isn't associated with any specific record. Why can I
use a global field to create a relationship?
As the Assign Expense example on Building the Assign Expenses Layout shows, relationships can
be created to support a layout that performs a specific task. When you use a global field in a rela-
tionship, it works just fine. You'll see related data just as you normally would.
This kind of relationship doesn't create a permanent connection between records—it just gives you
temporary access to related records when there's a value in the Expenses::Global Invoice ID field. If
you clear out that field, the relationship doesn't work anymore (it's called invalid ) and no line item
records will show in the portal. In this case, that's an asset since you can reduce visual clutter on the
layout by clearing Global Invoice ID field.
Since FileMaker doesn't index global fields, the relationship doesn't work the way you'd expect
when you look in the other direction—from the normal-field context back toward the global field.
From the Expenses::INVOICES direction, the relationship behaves like a Cartesian join ( Portal Fil-
tering ) , showing every record in the other table. That makes perfect sense, because every record in
the Expenses table has the same value in that global field. This behavior isn't important in situations
like the Assign Expenses layout, because you only care what happens from the global side of a rela-
tionship. So unlike regular relationships, where you can pull data reliably from either direction,
global relationships work in only one direction. As Figure 14-15 shows, FileMaker doesn't connect
the relationship line in the graph directly to the global field. This visual cue lets you know this rela-
tionship works only from the global side to the “normal” side.
One last point: You can display a global field's data in another table without a relationship. Since
global fields aren't associated with any record, you can view and modify them from anywhere, in-
cluding unrelated tables. It's common to create a table to hold values you need to use from many
different tables in a global table (say, your company's logo, name, address, and other contact in-
formation) and then use those fields on printed reports. That way, if any of that data changes, you
can change it in the global table, and it's immediately changed on all your reports.
Using GTRR to Switch TOGS
The layout you've just created is pretty slick, but there's one problem. Suppose you're on the
Expenses layout looking at an expense. You decide you want to assign an invoice line item to
it, so you use the Layout pop-up menu to switch to the Assign Expenses layout. Unfortu-
nately, when you do, you won't always see the same record. That's because each table occur-
rence has its own current record, found set, and sort order. Users will find this situation frus-
trating, since they may have to do a find on the new layout to see the expense they were just
looking at.
Search WWH ::




Custom Search