Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com�s entire library of video tutorials.
Let's use one of the new Script Triggers in FileMaker 11 to initialize these values whenever you exit the layout, so we're going to use OnLayoutExit to initialize these values to whatever we want them to be when they go to Form View or List View or go over to Invoices, once they exit that layout, set them back to whatever you want them to be and that might cut down on confusion. You, of course, could do this on an Open Script and set these to whatever you want them to be but you may want to have it happen whenever you're moving around in the database and when you come back for them to see everything rather than, you know, they might come back to a different customer and be confused and not see this and go, why are there only 3 invoices, or something like that. So, it might be a good idea to do this. It's up to you to decide but it's actually fairly easy to do. So we're going to go into Layout Mode. We're going to go to Layout Setup and we're going to go into Script Triggers and you'll see OnLayoutExit. Now, we actually could use OnLayoutEnter as well but I want to demonstrate OnLayoutExit here since it's a new FileMaker 11 script trigger, but if you have FileMaker 10 use OnLayout and it'll say not Enter but Load here, and that would essentially accomplish the same task here. So we'll come in here. If you have FileMaker 11 you can hit the Plus sign otherwise you have to back out of this if you have FileMaker 10 and add the script separately and then come back in here. And it's going to be a simple script. We're going to say: Reset Portal Filter. We'll come in here with a bunch of Set Fields. Say Set Field and we'll go and find our xdatelow first, tell it to set that to quote quote. We'll duplicate that, go to xdatehigh and then we'll duplicate that and we're going to do something a little bit more complicated for xdata, so we're going to say: valuelistitems. Now we've used this quite a bit before so I'm not going to explain it thoroughly but the idea here is to grab all of the items in a value list and put them into, in this case, into a field. The reasoning for that is what if we update our status value list? We have right now, you know, the values of Cancelled and Billed and all those kinds of things. What if we add a new type into there? Well, if we hard code it into this formula then we're going to have to update it as well so it's a lot better to use this function here instead. So we'll say: get filename because what it needs here is the name of the file for this valuelistitems and I want it to be as dynamic as possible. Now in the case of the value list we actually have to type it in in quotes. There we go. That will set it back to all the values checked there, which is what I want it to be. I could empty it out, of course, but I wanted them to be all checked. So we'll click OK, click OK. Go back into Browse Mode and let's set a few things here. Let's put this in there, put that in there, uncheck a couple of these and then all we have to do, if you switch here we're not exiting the layout but if we go to Form and then back to Notes and then look at Invoices you'll see that they've all been set back to the way, the standard way that we want to look at it. So, simple technique, but very easy to implement and very powerful because imagine if you try to do this without script triggers. How would you, all the different ways you get into a layout is what you'd have to do. You'd have to say, OK, if I come into the Notes layout by this button right here, or this button right here, you know, there's different ways to get to it. What if we came in from, you know, from the Invoice, we're over here in Invoices. You can see how that can make a centralized point for changing those values to what you want them so script triggers are much better than trying to find all the roads into that layout. It's much easier than trying to figure that and then, of course, you add another road into that layout and then you have to figure out, you know, you have to remember to add it. So this makes it all happen at that point just from that layout's point of view and makes it much simpler to do.
| Course: | FileMaker Pro 11: Advanced |
| Author: | John Mark Osborne |
| SKU: | 34140 |
| ISBN: | 1-936334-36-4 |
| Release Date: | 2010-07-09 |
| Duration: | 14.5 hrs / 159 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |