Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
In FileMaker Pro 11 Essential Training, Cris Ippolite demonstrates the principal features and functions of this popular database software, including creating tables and relationships, managing fields and records, and working with layouts. The course shows FileMaker developers how to find, sort, and share data as well as how to create reports, calculations, and scripts. It also covers brand new features in FileMaker Pro 11 such as the Inspector tool, charting, and portal filtering. Exercise files accompany the course.
Another group of Script Triggers are called layout-based Script Triggers. These are the triggers that you can assign to any given layout that will run an event or a script on the load of a record, for example, or the commit of a record, for loading of a layout, entering a new mode, or exiting a mode. But unlike their counterpart, the object -based triggers, they're set up on the Layout Setup dialog. So instead of going into Layout mode and just assigning them to an object, like we do to object-based triggers, we still have to go into Layout mode. And if you go into Layout mode in our Exercise File, you will see that there is this little pencil icon.
This will allow us to bring up the Layout Setup dialog. You can also get to it under Layouts > Layout Setup. You will notice that there's a tab all the way on the end here called Script Triggers. This reveals a list of all the different Script Triggers that are available for any given layout. Let me take a moment to briefly review the different triggers that are available. The first trigger is called OnRecordLoad. This triggerss a script to run after loading a record. Now, there are several actions that can load a record, including switching from record to record, switching layouts, because every time you go to a new layout you have to have a new active record, so that means that a record is loading, opening a new window also selects an active record.
creating or deleting a record, if you delete a record, it has to go to a new record. or performing a Find operation, because after you perform Find, you go back into Browse mode and one of the records becomes active. So this one is tricky. There are a lot of different areas that can actually load a record. You might consider using the OnRecordLoad if you have a table with records from different types that need to be displayed using different layouts. So, for example, if we had a different Customer Detail Layout designed depending on the status of a customer, then by simply navigating to another record, by saying go to next record in your Layout navigation, you could present a different layout to the user.
So you can have one for vendors, one for customers, one for employees, all happening when you're loading a new record. OnRecordCommit triggers a script to run before a record has been changed and is committed. So we have been talking a lot about committing a field, but what you might not be aware of is that you can make a change in a field, tab to another field in that same record, make another change, but you haven't yet committed either of those fields. Tabbing within a record will not commit any of those changes.
But then, if you make some changes in fields, tabbing through each field on the same record, and then you hit Commit, not only are you committing all the fields in that record, which by the way would trigger OnObjectSave triggers, but you're also committing the record. So switching to a different layout, if you've made some changes, that will commit your record. Pressing the Enter key or clicking outside of the record, that of course will commit it, because that commits fields. So any time you commit a field inside of a record, that commits the record. OnRecordRevert, this one's not too common.
It triggers a script to run before a set of records is reverted. Reverting only happens through the Revert Record menu. That's something where if you make a change, before you commit the change, you can go under the Records menu and hit Revert, and it will change your records back. It's really the only time that you would use the OnRecordRevert. OnLayoutKeystroke is similar to the OnObjectKeystroke. It's a very advanced trigger. It involves a lot of scripting and calculation and understanding to get it to work. It's a little outside the scope of this title, but if it sounds like something you might need, for example, it will trigger a script if you're on a layout and you hit any key or combination of keys on your keyboard, if that sounds like something you are interested in, by all means check the FileMaker Help.
Its got all sorts of details on the Layout Script Triggers. OnLayoutEnter simply triggers a script to run after a layout is loaded. So a layout is loaded most commonly after you switch or navigate to a layout. So that means we've loaded to this layout. So if you have a layout that has certain records on it that need to be sorted in a certain fashion, or if you want to perform a Find anytime you get on a certain layout, well, this is the type of thing that you would use there is the OnLayoutEnter. There is also a OnLayoutExit, which just does the inverse, which means right before you leave the layout, it would trigger the script to run.
Then there's the OnmodeEnter and OnmodeExit, and those are pretty much doing what you would imagine they would do. If you want to switch between Browse mode and Find mode or Find mode to Browse mode, that type of thing, you can run a script before you actually switch modes, And then OnmodeExit means if you're leaving Browse mode and going into Preview, it would trigger a script. Then of course once you get into Preview, it could trigger OnmodeEnter if you wanted it to. OnViewChange is when you switch views.
Views, of course are the Form View, List View, and Table View. So same kind of thing as the modes, but in this case it would be for any change from a view. So in our example that I am going to show you, we are going to attach a script to the loading of a layout, so that way anytime a user goes to this layout, the script will be run, and they'll see a group report onscreen. So if you remember from our chapter on Reporting, we've set up a subsummary report and of course the subsummary report needs one important thing to trigger it, and that is sorting by the break field.
So now we could remind our users and continue to train them to say every time you go to this report, you have to sort by the related company name field. Or we could simply add an OnLayoutEnter Script Trigger and choose our script that we created; we could choose an existing script, a script maybe we've created to run it, or we can just create a special script by hitting the Plus button, create a new one that's called Sort By Customer.
Then we can navigate down to Found Sets, double-click on Sort Records, and without bothering them with a dialog, we'll pop-up and say, Customers CompanyName, because as you see here, that's what our break field is, and that's how we set up this part. You can, for a refresher, go back into the Reports by Subsummary section and watch that movie again, but you will realize that the report will just look like a list in Browse mode unless the Sort happens.
So this way we say, Sort By Customer, OK, and we have a special script we just created just for this trigger. We hit OK again. We see it listed here. In this case, we are going to keep it on Browse mode. We are not going to sort in Find. That wouldn't make sense here. But we are going to do it Preview, in case somebody wants to Print Preview this from another layout; they'll at least see it grouped. So now we hit OK. Let's go into Browse mode, Save our changes. So you see, we are still on this layout. So we haven't left and loaded it again, but this is our subsummary report, but without sorting, it doesn't look like much.
In order to trigger this, we have to leave the layout. We will go to Customer Detail, and now we can navigate back to Invoice Lists. That's the layout that before we didn't see grouped. Now when we go to the layout, we see it grouped. As a matter fact, if we navigate all the way to the first record by typing in 1 and hitting Enter, we see everything grouped very nicely. So now no matter how we navigate to this layout, in either Browse, or as you see here Preview mode, it's automatically going to sort for the users.
As a matter of fact, we never even have to train the user to be able to sort these records. You can see that it might be just as handy to use Script Triggers on the layout level as they are on the object level. So it's probably a good idea for you to get familiar with these triggers before you start writing scripts, or even designing layouts, just so that you know the different actions that you can perform and how your scripts can be triggered on either the object or layout levels.
Find answers to the most frequently asked questions about FileMaker Pro 11 Essential Training.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.