Ultimate Find / Dynamic Scripting
Subtitles of the Movie
We're basically done with the Find script, but I'd like to make it work across all tables. In other words, I'd like to have a single Find script that works for customers, invoices, and products, and I'd like it to adapt automatically to any new table I add where I want to perform a Find. So it's actually very easy. Let's go into ScriptMaker, Manage Scripts. We'll find our Ultimate Find, Edit it, and we're going to come to our Go To Layout and we're going to do something we've done already. We're going to say Specify Layout Name by Calculation. We did Layout Number before, but we'll do Layout Name this time. The part we've done before is this formula. How do we make it go to the right Find layout? Because we're going to ultimately create a Find layout for invoices, one for customers, which we already have, and one for products. So how do we make it go to the right Find layout? Well, all we have to do is say Get Layout Name and then, based on our good naming conventions for our layouts, we just say Left Words semicolon 1 close paren, so get the left word of that Layout name. So if we're on a Customers layout, it's going to go to Customers Find, as long as we add on this. So here's where our good naming conventions really help us out. It light get Customers here and add Find onto it. It might get Invoice and add Find onto it. It might get Products and add Find onto it. It's that simple. We're all done with that. That will automatically choose the right layout; otherwise, everything else is dynamic, except for one thing, this little message here. We're going to again do the same thing. We're going to come in here and we want to change this to quote, ampersand, Left Words, Get Layout Name, semicolon, 1, close paren, ampersand, quote. We want this to be in proper, so we'll put proper around the whole thing and then close that and then we'll copy this whole thing to the clipboard. There we go. It's in the clipboard now. We'll double click here, type quote, ampersand, paste, ampersand, quote. We want this to be lower, since it's in the middle of a sentence. There we go. It's as simple as that. Now we have a dynamic message. Everything else is perfect. Now all we need is our layout, so we'll save this, close this, but before we make our other layout, let's try it out and make sure it works for customers. We got to the right layout, perfect. If we type in Johnny and hit Continue, we get that error message because Set Error Capture is off. Here's the error message users will see. You can see No Customers Are Located. It works perfectly. We'll hit No here. Let's go into Layout Mode and we're going to go ahead and actually, let's go back over to our invoices first and then we're going to go show the Status toolbar. We'll need that. Then we can enter Layout Mode. Actually, now that I think about it, we need to duplicate our Customers Find, so let's duplicate that one. We're going to Set Layout Order. We'll do Layout Setup here. Change this to, we need to make sure we get this spelled exactly. Invoices Find. Make sure you Show Records From Invoices. Then we'll, just to be nice and neat and clean, I want to have good tidiness here in your system because it's better to do it all while you're going, rather than all at once. I like to put this and rearrange these right away. So now what we have to do is change these things. Let's move this out of there. We have to change our title. Invoices. Carefully double click on the back here, type in the same thing. We have our 3D look and we want to change our field, so we're going to go to Invoices and we'll choose Date Post here. We'll call it Post Date. Then we'll choose one other field from Invoices and we'll choose Status. I think I'll also add a drop-down list and choose Status here. It's very easy to do. There we go, change our label. Now, we could put another field. In fact, we could have put a field from Customers because you might want to search for invoices that have particular customers' names on it. So we could actually leave the last name in here, but I'm going to actually take it off right now. Just these two fields will be good enough. Otherwise, these two buttons are dynamic. Everything is dynamic here. We're all ready to go, so all we have to do is navigate back to our Invoices form. Actually, we will need to go to our Customers form first because we need this button here, so we'll select that, show our object info. That's at 450,021. We'll come in and copy that. So we're copying that button. Remember this number and remember that we've added this button already to the other layouts in Customers, but we haven't added it to our Invoices form, so we'll paste in here, 450,021. There you go. Now, we'll have to do it on each layout. We'll add it to here. We'll paste it and we'll do 450 and now remember that on the List layout, it's going to be over a couple of pixels. 1, 2, 3, there we go. So now we're done. Now it will be up to you to add these buttons to all the Products layouts and then add the Products Find. I'll do that offline, but you'll have to do that as your homework, make sure you've got this done right. Let's try this out. Let's go ahead and hit Find. It goes to the right layout. We'll type in something it couldn't possibly find, hit Continue. That's because Set Error Capture is off. Hit Continue again. We'll hit No to this message, but before we do, we'll see that it says Invoices, Invoices, and notice it comes back to List View, so it's completely dynamic. Once you've written the script once, all you have to do now is add your layout. That's it. If you add your layout and you have good naming conventions, this will automatically work right away. That's why we spent so much time making this Find script, because it works dynamically across all tables. You don't have to make a separate Find script for each one.
Tutorial Information
| Course: | FileMaker Pro 10: Advanced |
| Author: | John Mark Osborne |
| SKU: | 33927 |
| ISBN: | 1-935320-20-3 |
| Release Date: | 2009-01-05 |
| Duration: | 12 hrs / 150 lessons |
| Work Files: |
Yes |
| Captions: | Available on CD and Online University |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |
VTC Sign up & Benefits
- Unlimited Access
- 81,350 Video Tutorials (20,800 free)
- Video Available as Flash or QuickTime
- Over 782 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 