Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Understanding multi-predicate relationships

From: FileMaker Pro 11 Essential Training

Video: Understanding multi-predicate relationships

The relationships in FileMaker Pro can and should be used to implement the basic primary key to foreign key relationships that are indicated inside of an entity relationship diagram. And so far in this title we've already used the relationship graph to plot our tables in our database and also to create the relationship between those tables. As a matter of fact, if we open up our relationship graph, which is under File > Manage > Database and then Relationships, it actually looks exactly like our entity relationship diagram, as you can see under File > Define Databases and the Relationship tab.

Understanding multi-predicate relationships

The relationships in FileMaker Pro can and should be used to implement the basic primary key to foreign key relationships that are indicated inside of an entity relationship diagram. And so far in this title we've already used the relationship graph to plot our tables in our database and also to create the relationship between those tables. As a matter of fact, if we open up our relationship graph, which is under File > Manage > Database and then Relationships, it actually looks exactly like our entity relationship diagram, as you can see under File > Define Databases and the Relationship tab.

However relationships that are set up in FileMaker Pro have many powerful uses beyond just establishing the underlying structure of a database. This is probably the closest thing to an intermediate topic in this entire title, so I don't want to scare you off. If you're comfortable with your understanding of relationships thus far, please continue. But if you just barely hanging on at the moment, you might want to stop here for now and come back after you get a little bit more practice. But otherwise let's move forward. You can always use relationships to view a tailored subset of related records or to drill down through several layers of data to form complex queries.

If you're coming from other database platforms, you might be familiar with the concept of queries and actually this might help you understand how FileMaker relationships work. For example, earlier in this chapter, we had a movie that talked about filtering a portal to only show related invoice records for the active customer, but only those related records that had a shipping status of shipped. This is a similar concept to the concept of a query. So although in that case we used the tool for portal filtering to just simply visually filter those layout objects, we can actually set up a relationship between two tables that has that criteria built-into it.

And we can do all of this from the Relationship graph. So first of all, all of these four boxes that we're looking at, the Customers, Invoices, InvoiceLineItem and Products, these are all what are called table occurrences in FileMaker. A table occurrence is actually what it sounds like. It's an occurrence or instance of a database table on the graph. So why bother throwing the word occurrence on there? Well that's because any one table can be represented by any number of table occurrences on the relationship graph. So in this example, and again just to clearly state our goals here, we want to create a relationship that when placed in the context of customers, let's say we want to create a portal on the customer layout, and when we use this relationship it's only going to show us related invoice records that have the status of Shipped.

The first step in order to do this is to create a new table occurrence based on the invoice table, so in this case a new child. And we do that here in the bottom left- hand corner, where we choose the button here that says Specify a New Table. So here we're going to choose Invoices and you see FileMaker puts a 2 after this. That's because every table occurrence must bear a unique name, so you'll always be prompted to name each table occurrence as you add it to the graph. But you don't have to name by number. We can name it something totally different and something that maybe describes what's happening in this relationship.

So we'll call it Invoices Shipped, based on the Invoice table. So here we have two table occurrences, both based on invoices, and the reason I have two of them is because I can't create two relationships between these two table occurrences. I can only have one discreet relationship between any two table occurrences. If I want to change the relationship, I have to create another Table Occurrence. Its kind of the tough concept to wrap your head around, but once you understand that, then you'll know when you need to create new ones and you have a little but more flexibility when you're working in your database.

So a single base table may appear many times in the relationship graph and participate in several different relationships and when I say base table, I'm talking about the underlying table. So notice that Invoices, there's still one table here. So that's what I'm referring to as the base table, even though there are two table occurrences. I didn't create a table, just a new table occurrence. So a single base table may appear many times in relationship graph and participate in several different relationships. And we see here we've got one that's called Invoice Shipped and one that's Invoices.

And so why are we doing this? Well we want to do this because we want to create a relationship with different properties between Customer and Invoices. So we already have this one here that plainly shows us all invoice records, where the value in the primary CustomerID field matches the value in the foreign key ID field. That's how that's going on in this portal that we were seeing earlier. So in plain English, it's saying, show me all my related invoices if you're on a Customer record. And we want to start there with this new one we're creating. So if you remember we create relationships between table occurrences by clicking into the primary key, holding down our cursor, and then releasing it.

And we're going to go primary key to foreign key. Now right now these are the same relationship, but we're not done yet. That's why we're creating another one. So now let's double-click the arrow between these two. You'll see this brings up a new window called the Edit Relationship dialog. And it gives us all sorts of information about the relationship. It tells us the parent table, child table, what the two match fields are, allows us to pick different match fields if we'd like to and change them, or you also see there's a button called Add. And that's really the whole concept here is that we can add additional match fields or additional criteria.

It means show me all the invoice records where the value in fkCustomersID also equals 1530. But now in addition to that, we're going to add another field. So if we scroll down to Customers, we've got a field here that's called ShippedCalc. Now this is the key to creating a filtered or multipredicate filtered relationship like we're doing here. What I've done is I've gone into the Customer table and simply defined a field that's a calculation, and the whole calculation is "Shipped".

So that means every single record in the parent table is going to have the word Shipped on it. I'll show you what that looks like when we're out of this dialog, but the idea there is that no matter what parent on, the parent is going to have their own primary key and then the word Shipped inside this field. So we want this field to match up with ShipmentStatus. We're going to hit add now that I've gotten both selected. So now what we're saying is, in the portal, show me all the records where in this case the number 1530 appears in the foreign key field and also we've got ShippedCalc.

That's giving us the value Shipped. We could see that onscreen . It would just say for every record. So every record that has 1530 in this field and Shipped in the ShipmentStatus will be a related record. So now let's hit okay and see this in action and first before we leave, I want to show you in the Customers table, ShippedCalc, simple calculation, text, just the word Shipped wrapped in there. That's going to give us the same value for every single customer record. They are going to say Shipped.

So now in Layout mode, let's drag select this portal with the fields in there. And you see they are all selected, and I'm going to hit Copy, and I want to go into the Shipped tab that we've created here. Now click inside here. And I'm going to hit Paste. Right-click, Paste. And to I'll move that and to right about this area there. Now you see some of those didn't come through. I'm going to teach you little trick. When you paste more than one layout object into a tabbed panel, you can get some kind of mixed reaction. It's just kind of a weird feature in FileMaker.

So what I'm going to do I'm going to group them all together. What I'm going to do is I'm going to try bringing them forward first. So what I'm going to do is I'm going to click outside this area so they're not selected anymore, and I'm going to just select the area where those fields were and say to Bring to Front. It's a strange feature in FileMaker, just something that you'll have to be used to, but if you've ever paste multiple layout objects into a tabbed panel you do have to go through this. One of the things we could've done is group them before we copy them and pasted them and then ungroup them.

But now we've got the same portal, but let's double-click on the portal and let's change it to Invoices Shipped. Now here's something interesting. It says under Related Tables it's showing the same table twice and that's because we have two table occurrences based on this table. We're going to pick Invoices Shipped, but now we've updated the portal. We also have to update the field. So you'd see here Invoices Shipped, Invoices Shipped and two more, Invoices Shipped.

So now let's go into Browse mode, saving our changes, and you look and you see all the different records that we've got here, but when we click on the Shipped one it's only showing us the ones that are shipped. Same thing here we've got two, one that says Shipped, one that says Processing, and then this only shows the ones it's shipped. So now the concept is we could also create duplicate calculations if we want. Let's so into Manage > Database and then Customers, we've got InvoiceTotal.

Let's say Duplicate, and let's quickly change it to InvoiceShippedTotal, hit Change, hit Options. Now we're going to use a different related field. We're going to pick the Invoice Shipped version of InvoiceTotal. So what's happening is it's filtering this down to just the InvoiceTotal values related to this parent but the ones I've shipped in there.

Now, we hit OK and if we go in the Layout mode, we can click into this portal. We can click into that tab panel and shift click the label and the field, drag them in here, fix the body, go back in our Browse mode and save our changes. And now we see the total for all these, which is 58,000 for all of them, and now we're going to Shipped, and we see the total is just 49,000 ,which actually matches that if we have formatted that properly.

So here we created a new table occurrence between the two tables and then set up the relationship between the Customer table occurrence and the Invoice one with different criteria. Actually, we added additional criteria to it. This is just the tip of the iceberg with complex relationships, but it's a good example of the things that you can do between two different tables in FileMaker solution. And this is certainly a more intermediate topic and hopefully we haven't scared you away from some of the relationship concepts here, but if this made a little the sense to you, there is a whole other level you can go in to with working with filter table occurrences.

So I urge you to play around with this concept a little bit and build this into your own solution and see if you can get this to click.

Show transcript

This video is part of

Image for FileMaker Pro 11 Essential Training
FileMaker Pro 11 Essential Training

94 video lessons · 14871 viewers

Cris Ippolite
Author

 
Expand all | Collapse all
  1. 7m 22s
    1. Welcome
      1m 8s
    2. Understanding the FileMaker family
      2m 15s
    3. Using the FileMaker Quick Start screen
      2m 52s
    4. Using the exercise files
      1m 7s
  2. 21m 9s
    1. What is a database?
      2m 26s
    2. Flat vs. relational databases
      2m 29s
    3. How FileMaker works
      4m 48s
    4. Understanding the essential preferences
      3m 13s
    5. Touring the interface
      8m 13s
  3. 11m 44s
    1. Creating databases from templates
      2m 29s
    2. Creating new databases in the spreadsheet-like format
      5m 35s
    3. Importing tables
      3m 40s
  4. 9m 9s
    1. Determining which tables you will need
      5m 10s
    2. Creating tables in the Managing Tables window
      3m 59s
  5. 34m 47s
    1. Understanding relationship types
      6m 58s
    2. Diagramming relationships (with ER diagrams)
      8m 50s
    3. Determining which key fields you need
      5m 18s
    4. Defining primary and foreign keys
      7m 56s
    5. Creating relationships using the relationships graph and table occurrences
      5m 45s
  6. 50m 34s
    1. Deciding what fields you will need
      5m 34s
    2. Understanding field types
      7m 54s
    3. Defining fields
      9m 56s
    4. Using Auto Enter options in fields
      9m 33s
    5. Reviewing field validation options
      8m 16s
    6. Building with container fields
      9m 21s
  7. 14m 8s
    1. Creating and duplicating records
      5m 40s
    2. Editing and locking records
      4m 42s
    3. Deleting records and backing up files
      3m 46s
  8. 21m 6s
    1. Importing data
      9m 57s
    2. Importing records to refresh data
      7m 2s
    3. Exporting data
      4m 7s
  9. 18m 30s
    1. Understanding layouts
      4m 15s
    2. Using the Layout Assistant to create List views
      7m 59s
    3. Using the Layout Assistant to create labels and envelopes
      6m 16s
  10. 27m 11s
    1. Using the Layout Setup dialog box
      4m 54s
    2. Understanding layout parts
      4m 40s
    3. Understanding the new Inspector
      2m 26s
    4. Exploring the Status Area in Layout mode
      6m 46s
    5. Managing layouts and layout folders
      8m 25s
  11. 41m 9s
    1. Arranging, aligning, grouping, and locking layout objects
      11m 5s
    2. Placing and formatting objects, parts, and graphics
      4m 10s
    3. Formatting fields and applying field attributes
      8m 26s
    4. Setting field behaviors
      4m 4s
    5. Using the Tab Control feature
      9m 8s
    6. Setting tab order
      4m 16s
  12. 36m 48s
    1. Using the basic find functions
      7m 31s
    2. Reviewing new requests in the Find mode
      5m 54s
    3. Establishing search operators
      6m 43s
    4. Constraining or extending found sets
      3m 24s
    5. Finding records using date, time, or timestamp criteria
      5m 18s
    6. Using Fast Match and Quick Find
      4m 41s
    7. Working with saved finds
      3m 17s
  13. 17m 28s
    1. Sorting with one criterion
      6m 4s
    2. Sorting with related fields
      2m 18s
    3. Sorting with multiple criteria
      1m 36s
    4. Sorting using custom values
      3m 14s
    5. Sorting using buttons
      4m 16s
  14. 17m 14s
    1. Reviewing Field/Control styles
      5m 43s
    2. Creating and applying static value lists
      5m 20s
    3. Creating and applying dynamic value lists
      6m 11s
  15. 23m 52s
    1. Previewing pages and print options
      6m 20s
    2. Printing in different views
      2m 54s
    3. Sliding objects
      3m 26s
    4. Printing merge letters
      4m 53s
    5. Saving as a PDF or Excel file
      6m 19s
  16. 15m 1s
    1. Building simple reports with summary fields
      4m 36s
    2. Creating subsummary reports
      6m 51s
    3. Creating subsummary reports in Table view
      3m 34s
  17. 52m 19s
    1. Defining calculations
      2m 31s
    2. Exploring the Calculation dialog box
      5m 8s
    3. Using number functions
      12m 41s
    4. Using date and time functions
      4m 58s
    5. Using text functions
      11m 43s
    6. Using get functions
      4m 0s
    7. Using logic functions
      11m 18s
  18. 46m 56s
    1. Understanding scripts and script steps
      2m 23s
    2. Assigning script steps to buttons
      3m 54s
    3. Understanding the ScriptMaker dialog box
      8m 28s
    4. Creating multi-line scripts
      6m 44s
    5. Adding find criteria to a script
      4m 58s
    6. Understanding the If script step
      8m 36s
    7. Using script parameters
      4m 42s
    8. Reviewing the Send Mail option
      7m 11s
  19. 28m 0s
    1. Understanding script triggers
      2m 41s
    2. Using object-based triggers
      11m 58s
    3. Using layout-based triggers
      7m 51s
    4. Using file-based triggers (Open and Close scripts)
      5m 30s
  20. 56m 42s
    1. Using related fields
      7m 18s
    2. Creating portals and using portal filtering
      10m 38s
    3. Using related fields in calculations
      7m 6s
    4. Understanding multi-predicate relationships
      11m 11s
    5. Using the Go to Related Record script step
      7m 26s
    6. Creating a chart
      13m 3s
  21. 30s
    1. Goodbye
      30s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed FileMaker Pro 11 Essential Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.