Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
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.
Earlier in this title we looked at assigning a single script step to a button on a layout. Although this technique is very effective for things like sort buttons or navigation buttons, you'll find that most scripts will have multiple lines of steps, just because it's much more useful to store a series of actions in a script than just one. Now, although it makes sense to create a single line script for use with Script Triggers, which we'll talk about later on in this title, this video will focus on creating a multiple line script. So let me show you an example of creating a script instead of just assigning a script step to a button.
We'll go into our Customer Detail and go into Layout mode and you'll notice in the upper right-hand corner we have this Printer icon. If we were to apply a single script step to that button, let's say apply the print action, then when you press the button it only prints the layout that you are currently on. However, this layout, as you can see, is not particularly print-friendly and therefore shouldn't be the one that prints; instead, let's say we have another layout, for example, we could use the Customer Welcome Letter we created, which is in fact print ready. So you already see, as we look at a certain action, that we've already got multiple actions that occur.
We would like to navigate the user to the appropriate layout, print that layout, and then move back to where they started, and that all takes multiple actions instead of just the one print action. So in this case, we would write a script with all those multiple steps and then have that assigned to the Print Run, and then we would have that script assigned to the Print button. So in our Exercise File, I am going to go ahead and create a new script that does those various different steps, like moving from the layout, to the Print Layout, printing, and then back to where you started. But remember, each time you create a script, you want to first start out and sketch out the steps that you want to perform.
So ideally you would do this on a piece of paper. Much like anything else, plan first and then execute in FileMaker after you have done the plan. So here is what our steps would be. First, navigate to the Custom Welcome Letter layout. Second, set the Page Setup to only Print the Current Record, then Print, and then Navigate Back to the Original Layout. Our goal will be to create a script that is a collection of script steps that perform these actions, in the same order that we listed them in our list, because remember, the order in which script steps execute is just as important as the steps. So let's create a new script by going under the Scripts menu, to Manage Scripts, and let's say New > Empty Script.
Let's name this script something that helps us remember what it does. How about Print Welcome Letter? And now we are going to browse through the different steps, showing all the client-compatible ones. We want to find one that will accomplish the task, which is the first one in our list, which is Navigate to the Custom Welcome Letter Layout. That step is the Go to Layout, so let's select Go to Layout and double-click on it, and now you see we've got that in our entry area. And also, once we have that selected, you see that we've also got some Script Step Options. We have to specify the layout that we want to navigate to. So let's choose Layout from the dropdown, and we'll choose Customer Welcome Letter, and then hit OK.
Now, remember, in our sketch we said that we want to take them to another layout, but then we want to allow them to set some Print Setup options and then eventually print the document. So step number one here was to Navigate to the Print Layout, which we already have. Next, we want to be able to print this item, but first we want to set some Print Setup options. So if we isolate the Files category, you'll see that we've got a Print Setup option. We'll double-click on that and move it into our window. Now, if you're on a Windows, this will say Page Setup, but they're the same script step.
First, we'll want to perform this without dialog, which means don't pop up the usual dialog you see to the user, because we're going to specify the settings ourselves. And then you'll notice when we hit the Specify button, and you'll see the Page Setup dialog, and we're going to make sure that its got the right Orientation and Scale, Paper Size, and such, and now we are going to add a Print step, and we are going to specify the Print options to print the Current record only, and we'll hit Print. We can even specify the printer that we want it to print towards. So you'll see that there's a printer selected, and if we want to choose a different printer, we can just simply click on the dropdown and choose a different printer.
Now, we've got all of our steps, except for returning the user to the layout where they started. Well, interestingly enough, if you look inside of the Navigation Set, you see Go to Layout, the one that we've already used has an option, by default, to return to the original layout. So we can just use Go to Layout step again and select original layout. So now we've got our New Script, but we see that it's unsaved because we have the asterisk, so let's go ahead and Save the script, and now return back to our Customer Detail Layout, and we are going to select the Layout object, and in this case we're going to right-click or Ctrl+click on Mac and choose Button Setup.
Now, anytime you have a multiline script that you want to run and assign that to a button, you're going to choose Perform Script, and in that case, you'll just hit the Specify button and choose the script. You'll also notice, if you get to the Specify Script window, you can create a script by hitting the Plus button, in case you don't already have one created. Hitting OK and hitting OK will take us back to the Customer Detail Lists, and we'll view this in Browse mode, Save our changes, and now let's hit our Print button.
And you see what its done is it's printed out a letter for us, in this case in Preview, but it's for the current record that we are on, not the Found Set and its taken us back to our original layout. One final step that I am going to put on the Script is to pop up a dialog to show the user that the letter has been printed. So we can go in and edit an existing script by double-clicking on it, and if you scroll all the way down to the bottom, you'll see that under Miscellaneous, there's something called Show Custom Dialog.
This is a way that you can interact with your user, even allow them to make choices, which we'll use later on, but in this case we're just going to show them a message by typing in the value that's going to show up in the Header here and then also the message that will appear. And you can just simply type some text in here, and you've got options for up to three buttons, but in this case we just want to say OK, so they can disregard. But you also notice you have Specify buttons. So you can use what you've learned with calculations to create a combination of text with an ampersand and add the CompanyName.
So you can say "The Letter Has Printed" for and then the CompanyName. So now let's hit OK. And if we try to close without saving, it prompts us to Save. Now we've saved. We go back into Browse mode, and let's try it again. Hit Preview, and now you see it has, our letter has printed, for the company, from the active record that appears in the Welcome Letter. Scripts can be useful either as a single step applied to a button or as multiline scripts, and you'll find that most of the scripts you create will be a combination of different steps, making them a lot more useful and dynamic.
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.