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.
Throughout this chapter, we've been discussing creating scripts. Now creating a script is one thing, but triggering those scripts or allowing those scripts to run is something entirely different. FileMaker Pro 11 has all sorts of ways that you can trigger the execution of a script, and we'll cover all of them in the upcoming chapter on Script Triggers. But let's concentrate on assigning a script to a button. For example, if you open up the 17_07 exercise file, and go to Customer List, and go into Layout mode, you'll notice that we have several layout objects onscreen. Of course, we can select any one of them.
For example, I can choose the State field label. That's a text layout object. I can right-click on it or Control- click on Mac, and hit Button Setup. You'll see here this has a script step assigned to it. I could then select a New Button, for example, draw one onscreen. If I want to perform a script, then I'll choose the Perform Script script step, I hit Specify button, and now you see something down below here called Optional script parameter. Well, we've been ignoring those until now in this video, but I want to show you what an example of a Script parameter is first.
Let me show you one in action. So let's say we go back into Browse mode. I'm not going to save any of our changes. Now you see what we've got on the top of screen here is a series of buttons. Of course, we've got 1,523 records in our Customer database on List view. But what we've done is we've created a series of buttons that whenever a user clicks on one of the letters, creates a found set of all the customer last names that begin with that letter. You see as we keep pressing the different letters, we get different results. So you would imagine, okay, we've got 26 different options, how many scripts would that possibly take us to create? Well, certainly your first thought would be that you have to create 26 scripts.
Well, let's take a look here. We actually only have one new script here, and it's called QuickFind. Let's edit that, and take a look at what's going on there. So what this script does is Enters Find mode, but then it sets a value into the Customer last name field, but what is this value here? It's get ScriptParameter. Let's take a look at what a ScriptParameter might be. If we go back to the Layout, how is it that we have one script doing 26 different things? Well, let's go into Layout mode, and select the A, for example. We'll hit Format > Button.
Here we're just specifying Perform Script, and then hit the Specify button, and we pick QuickFind. But now you look down below here in the Optional script parameter. There is text for the letter A. If we go to K, then right-click this time and do Button Setup, and click the Specify, we see there is text for the letter K. Every one of these letters has the same script running, QuickFind, but it has a different piece of text. So back in our script, what this does is when it gets down to entering Find mode, it essentially puts the cursor in the customer last name field.
Then the value it places in there is coming from this function here called Get(ScriptParameter). Well, the letter that we're placing inside that field when we're assigning a script to a button is the area that says optional ScriptParameter. So anything you put in there becomes a ScriptParameter. Then it can get unpackaged in the script that you're calling by using the Get(ScriptParameter) function. So now, really, the script can only be three steps long: Enter Find mode, put the ScriptParameter in the last name field, and then Perform the Find. The rest of it just simply checks to see if there were no records.
If there are no records, it shows us a warning. So here is an example of having 26 different things that a script could do, but only one Script written to do those 26 things. The idea behind a ScriptParameter was to make Script writing more efficient, so that you don't have to create as many scripts. So later in this title, we'll be talking about Script Triggers, but just a note while we're on this topic: You can set a ScriptParameter there, as well. So when we get to Script Triggers, I'll show you how you can use this concept. The ScriptParameter is just a piece of information, whether it's text, a field or an entire algorithm that you can put in there, because of course, if you notice, you can invoke the Specify Calculation dialog.
So you can put anything that you want in here, whether it's just text, an entire algorithm, other fields that you want to reference, whatever it might be. Then you can unpackage them back in the script with the use of the Get (ScriptParameter) function, either inside of an If step, or as you saw there, there is a script step are called Set Field. Anything that uses the Calculation dialog window allows you to unpackage that script step using Get ScriptParameter. So remember, when you're triggering a script that you've authored in FileMaker as either a trigger, a button, a subscript, you have the option to specify a ScriptParameter.
This will allow you to get some of the same functionality out of your FileMaker solution, but yet author fewer scripts.
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.