Ultimate Find / No Find Criteria pt. 2
Subtitles of the Movie
Now, there's another way to do this and I like this better for this situation, if you don't have FileMaker 10, which is we'll change this back to Get Last Error and we'll click OK on that, change this one back to Get Last Error, so that's back to what we had before. What I'm going to do is swap these. I'm going to take this and make this an Error 400, make this an Error 401, and then what we'll do is we'll swap these. I'll move the Elseif up here and then move your Show Custom Dialog up here. So now we've swapped them, essentially. Now the error 401, we still really have the same problem. In other words, it'll get the error 400, but now it won't get the error 401 if you have a version previous to FileMaker 10. So the way we solve that is we come in here and say If Get Last Error equals 401, we say Get FoundCount equals 0. So we just use something that has nothing to do with errors, so we don't have to worry about losing that error. I like this because we don't need that extra set variable. We can take that out now. It's gone. We don't need it anymore at all because we're checking, right after Perform Find, for this error and then down here we're checking for FoundCount equals 0, which is really the same as 401 error. So we can get around that and remove that. I show you this not because it's going to make a gigantic difference here, but every time you do this, in every situation you make one less or two less script steps, it makes it easier and easier to read your script because it's shorter and shorter and that generally holds true. It doesn't always, but a lot of times it's better for shorter scripts. They run faster and they're easier to read. But we're going to switch back to what we had before because this is FileMaker 10, so we'll say Get Last Error equals 401. There we go. We'll just leave it like this. This will work just fine. We can test this one first and test this one second, so let's go ahead and try this. We'll close this, save it, close that, and I like to test everything. When you modify a script substantially, you want to make sure you test every scenario, so we'll come in here, put in John, make sure we can find it. Works great. We'll go into Find again. This time we'll type in something it can't find. There we go. Hit Continue. We get the FileMaker message because we have Set Error Capture off. We'll continue. We get our message, which is great. Then we'll try it again. No Find criteria this time. We get the FileMaker message and then we get our message. So that works great, but let's take a look at this and you can see that right after we hit continue, we can see, because if we had Set Error Capture On, we wouldn't have seen that first message. We can see our data in the background. It's the same issue we covered before. I'd like to solve that problem by putting in a Freeze Window. It's very easy to solve. So we'll come in here to our Ultimate Find, put in a Freeze Window, move that over, so right before actually, this goes up here. I almost made a mistake. Right before this one, we want to freeze the window so we don't see our data in the background. So let's save that, see how this works. No Find Criteria. You can see how we still see Find mode in the background because we froze the window. This is one of the main scenarios where I use Freeze Window, other than for a looping script. There are other situations, but if you ever get something in the background that you don't want to see, you can always freeze the window and FileMaker will stop that re-draw so you can do anything in the foreground and not have to worry about what's going on in the background. You can freeze a couple of steps before, if you want, and have it show that. It sometimes comes in very handy. So there you go, there's your script. Just remember that FileMaker 10 doesn't lose the error when it's looking at If statements. Only in FileMaker 9 and earlier will you have to use those other two solutions.
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
- 98,729 Video Tutorials (23,265 free)
- Video Available as Flash or QuickTime
- Over 1026 Courses
- $30 for One Month Access
- Multi-User Discounts Available
United States 