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

Using related fields in calculations

From: FileMaker Pro 11 Essential Training

Video: Using related fields in calculations

In this chapter, we've been looking at many different ways to use the relationships that we've set up in our FileMaker database to display different types of related data, either in the context of a parent or a child table. There are also some other things that you can do with related fields, including using the calculation engine. In this example, what I'm going to do is I'm going to create a calculation field that's going to give us the grand total of all of the related invoices to any given customer. So, it's going to total up all these values, for example, or that value.

Using related fields in calculations

In this chapter, we've been looking at many different ways to use the relationships that we've set up in our FileMaker database to display different types of related data, either in the context of a parent or a child table. There are also some other things that you can do with related fields, including using the calculation engine. In this example, what I'm going to do is I'm going to create a calculation field that's going to give us the grand total of all of the related invoices to any given customer. So, it's going to total up all these values, for example, or that value.

This is going to be a dynamic piece of data. So, every time a new invoice is added, it's going to automatically update. So, this is going to be a little bit different than the concept of borrowing a field from a related table or using a portal. In this case, what we're going to do is create a calculation field that uses a new set of calculation functions I want to introduce you to. So, let's go into File > Manage > Database and inside the Customers table let's create a new field that's called InvoiceTotal.

Let's make it a Calculation. When we hit Create, we're going to see the Specify Calculation window. Now I'd like to introduce you to a couple of functions that fall under the Aggregate functions group. These are pretty simple. Although you have these optional parameters in each one, really it's just a function and then you put a field inside of it. So, for example, you see things like Average and Count and Max and Min and Sum. So, what you would do in the case of Sum, for example, is you could put a list of fields in here, all delimited by commas, and it's going to total up the numeric values inside the fields. Or I could just put 1, 2, 3, or 1, that kind of thing, and it will give me a total.

But forget those uses. The real magic behind an aggregate is when you use a related value, specifically a value that comes from a child table. So, here we are in the Customers table, in the context of the Customers table. By the way, you can see the context here, just to remind you. What we're going to do instead is reach down into the Invoices table, which is the child, and we're going to grab one field, InvoiceTotal. So, now what this does, anytime that you put a single related field in as your parameter inside of an aggregate, what it's actually going to do is go and find all related records and give you the sum of just the values inside of InvoiceTotal.

So, let's see how this works. So, we've got Sum (Invoices:: InvoiceTotal), Calculation result is a Number. So, let's say OK, OK, and you see we've got our fields here. But let's go into Layout mode for a second and Shift+Click on these values. Put them over here. We can click on this little line here to shrink our body back up to what it was before. If the fields weren't automatically added to your layout, then you have different preference settings. You can then go into Insert > Field, and choose the field we just created.

I'm going to pick this field, then I'm going to go in and give it some currency formatting, widening it out a little bit. I notice here that my portal is based on Invoices. So, that's going to help me view all of the invoices that we're going to be summarizing here. I see it's got a sort value applied to it, but I also see it's got a filter. So, let me double-click on this, turn that filter off, because we want to see all of the invoices, because that's what's going to be reflected in this total.

So, now let's go into Browse mode and take a look at what we've got. Hit Save, and now we see what we've got is the total of all of the related invoices. If we go over to the next record, we see yup, $49,737, $9037, giving us $58,775. So, you see it's updating for every record that we go to, but then it's also updating every time a new invoice is created, whether by you in another layout or by another user if this is a shared file.

Let me show you another one since these are so quick and easy to create. We've got InvoiceTotal. Let's hit Duplicate and let's delete this name and say invoice average instead, and we'll say Change. We see a change. We say Options and instead of Sum, you see there's another Aggregate function called Average. It's got the same format. So, all I have to do is change this name to say Average. Keep everything the same and I say OK.

Now we go View > Layout Mode. I'm going to Shift+Select these two fields, and actually if I don't want to have to format them again, I can just delete them. Instead, I'll grab this one, holding down the Option key on Mac, pick our new one, grab a title. Now, I don't have to go and apply this format into it. Now, we go in Browse mode, save our changes, and now we see the average. We see here this is what the average order is.

So, very simple and easy fields to create. I'll show you. There is a couple of more. We've got Average, Total, how about we'll create a Max, meaning the high end, duplicate that. Create a minimum, meaning the low end. Let's go and update these. So, you see Aggregate functions. We've got a Max and a Min, and what the Max does is it tells me out of all the related invoices, what's the highest total that I've got, the maximum value.

Since this is a number field that we're referencing, it's going to be the highest number, the maximum number. That was our Min. We're going to do Min in that case. See how easy it is to change? You can see I'm just typing in the name of the function. I could double-click on it, but it saves me a couple of keystrokes there. Here, I'm going to change Average to Max, OK, OK. We go back into Layout mode. We'll get rid of these again. Hitting the Delete key, and in this case, we're going to hold down the Option key on my Mac and hold down the Option key on my Mac again.

Now, we're going to go back into Browse mode, saving our changes, and now we've got all sorts of really cool information, all using related values from our portal. And it updates from record to record. Using related fields in your calculations, especially Aggregate function calculations, when you're in the context of a parent can provide some very useful dynamic values with very little overhead.

Show transcript

This video is part of

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

94 video lessons · 15072 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 preferences from 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.