Ultimate Find / No Records Found
Subtitles of the Movie
One of the reasons you add scripts to a FileMaker solution is to make it user-friendly and here's a great example. If we hit the Find button and type in something it can't locate, we're going to get the following message. So let's try it out. We'll type in Johnny, click Continue, and you'll get this message. There are a lot of things wrong with this message from a user standpoint. You, as a developer, understand this message, but from a user's standpoint, they may not understand what a record is. They're in customers or invoices or products. What's a record? What's a request? They may not understand that. Then all these buttons down here, what do these do? You have Cancel, Continue, and Modify. The Cancel button, if we have Allow User Abort off, will not be here, so realize that. It'll just be gone. You'll just have these two buttons here. But which one do they click, Continue or Modify Find? Well, as a developer, you know exactly what these two. Modify Find allows you to go back in and change Johnny. Continue allows you to continue on with the script. I'm going to choose this one and notice that you come up with now 0 records, which can be very confusing for a user. You don't want them to come into that situation. You want to avoid that situation for them. You don't want to have them have to figure out how to show all records and things like that or call you up and say all my records are gone, things like that. It's just not a good way to interface with the user. You don't want them to see that. So what we're going to do is we're going to add in an error check for that. We're going to check for that error, so we're going to go into ScriptMaker and manage scripts, and we've already shown how to look for these errors. In fact, we already know what this error is. It's a 401. We're just going to go more in-depth into how to work with these areas and more details about how they work. So, what we're going to do is come in here and we could just come to our Ultimate Find and put Set Error Capture in here, but we know that we have a better solution. We can duplicate this Allow User Abort, edit it, call it Set Error Capture, and we'll come in and replace these Allow User Aborts with Set Error Capture. Because remember, Set Error Capture is the same as Allow User Abort. It defaults to off when the script is done running, so we're going to turn it on for users and we're going to turn it off for you because when you're logged on, you may not have known there was this type of error that could occur and so when you're messing around with it and testing it, you want to make sure that it's off so that you can see that error and go, oh, I'm going to put that into my script and test for that. But for right now, so I don't have to close and open with the user account, I'm going to turn it on. We'll have to remember to come back here and turn it off again, but for right now, I want to be able to see what happens when I have Set Error Capture on. So we'll close that and save it, come back to our Ultimate Find, duplicate that, tell it to perform Set Error Capture. There we go. Save that. Let's run through the same scenario. We'll click on the Find, type in something it can't locate, click Continue, and you notice it just went through the entire script. It ran through the entire thing. In fact, it clicked on that Continue button that we clicked on before, in that Error message. It's very important to note that that's what it did. Even though you didn't see that error message, the Set Error Capture On just said don't show me the error, but really don't show it to me by clicking on that Continue button. You know that because it ran through the rest of the script and you know have 0 records found. So this is great. Now that we have the error gone and we know that Set Error Capture says don't show me that error message, now we need a trap for it. So we'll come down to Ultimate Find and right after where the error occurs, which is right here, we'll put an IF statement in. We'll say Get Last Error equals 401. So remember that the 401, the way we figured that out was using the script debugger and it shows you the error, so if you're running through the script, you can see the errors that occur by, you know, by typing in Johnny with the script debugger running and it'll show you exactly what error occurs. If you don't have FileMaker Advanced, well, then what you can do is put in a Show Custom Dialog and say show me Get Last Error, this formula right here, and when the error comes in, you'll have a Show Custom Dialog right after Perform Find and you'll see what that error number is. So that's a quick way to figure out what these are. So, we want to go in here and Show Custom Dialog, mov it in there. Then we'll say No Customers Found. We've already got a much better message already. It's talking their language. So we'll say No Customers Were Located. Let's make sure we spell that right, get the O in there. Here's your big chance to make a better message. Tell them what they need to do. Click The OK Button To Go Back to Data Entry Mode. So I get to choose what I want to call Browse Mode. I think Data Entry mode might be better. We'll come down here, take the Cancel out, click OK, and then we have one other thing. We need a Show All Records here. Remember, we don't want to leave them with No Records In The Found Set because they might think they deleted everything. So we'll move that in and now we have two choices here. We can put Show All Records here or Show All Records here, ultimately the same result, but let's leave it here for right now and see what happens. So I'm going to close this, save it, close it, run our script, type in Johnny, click Continue. It gives us our message, but notice in the background, we can see data. Let's go ahead and change that around, come into our Ultimate Find and we'll switch Show All Records to after that. Run it again, type in Johnny, click Continue, and you can see the difference here. We haven't shown all records. We're in Browse Mode, but we're showing no records, so it doesn't appear they found anything. That can be confusing for a user if they come over here, since, well, I did locate something. Well, you don't want them to get confused and, believe me, I've had many people get confused. If you're not convinced, do it this way. It'll be much better, because I've had tons of people get confused. So just the placement of that little script step, that show all records, makes a big difference. So you want to very fine tune your scripts. Think about everything because it really will make a difference. So just before we're doing this, let's go back into our Set Error Capture and we'll turn that off because this really should be off here for the full access, so we'll save that, close it, and we're ready to go on to the next step in our Ultimate Find.
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 