Calculations / GetNthRecord Tooltip
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.
Learn More
Subtitles of the Movie
I want to introduce you to the GetNthRecord function because it's very unique and very useful in a lot of ways. We're also going to be using it in the Advanced tutorial, so we're going to do a very basic introductory technique here that will help you understand it, plant the seed, so when we come to that more advanced application you'll really understand how to use it. Now even though this is a fairly basic technique it's actually very cool and very interesting. What we're going to do is we're going to use a Tool Tip and rather than display something like Next Record and Previous Record, we're actually going to display what's on the next record. So on this case when we hovered over it, if we take a look at the next record it would say Aida Osborne and all her information, and then if we're over here and hovered over it, this should say John Osborne, so that's the idea behind what we're going to do, and GetNthRecord will help us do that. So we'll click on this button, go to Set Tool Tip, and up until now you've typed in just static text, you know, quote blah blah blah quote. What we're going to put in here is a Calculated formula that's completed calculated and there's really no static text here for the most part. And we're going to use our GetNthRecord as we said, now GetNthRecord has two parameters, so let's take a look at it. There it is. It needs a Field Name, which we're going to provide it with Company for right now, and then it needs a number, and that number would refer to a record within the Found set. That's what makes it so unique. It actually works with the records in the Found set, so you can say grab me the company off of record 10, or record 4, or record 3, but most typically the way you use it is dynamically. What we want to do is we want to look at the record based on the Current Record, so we want to look at the next record so we have to know where we're at. So if we're on Record 2 we need to look at Record 3. If we're on Record 6 we need to look at Record 7. So there's another function, it's a Get function, and that will give us our Get Record Number. There it is right there. So we'll type in Get Record Number plus Ð so that's going to give us a record number relative to where we're at, so it will change as we're going through the records, it'll know what the next record is. And so we would then at this point concatenate this with a pilcro and then we'll copy this whole thing, Copy with the Keyboard Command, Paste it, and this time I'll put in Name Full. And then we can go on and on and on and on and put that in, but you're noticing that we're repeating this formula over and over again. And I'm going to use a Let function here; not because it's going to make it any faster or easier to read necessarily, it's not a lot of code. I'm going to do it because you'll see when we put it on the Previous button how much easier it makes it. So I'm going to Copy this, use the Keyboard Command, call it At Next Record equals, we'll paste it right in there, semicolon and now I'm going to grab this, Copy it and put it wherever I see that code, Paste it, and Paste one more time, and then we can continue on. So I'll hit a couple returns, Paste, this will be Address 1, there we go, return Paste, this will be City, and then we'll say comma space and we'll Paste one more time. This will be our State and that'll be just a space and we'll Paste one more time and that'll be our Postal Code, there we go, and then we don't need anything at the end. We will go ahead and close off our Let function here. So there we go, we'll click OK, click OK again, you see the little Icon there for the Tool Tip, remember that's done in Review Show, you can see Tooltips is on so we can see what objects have them on it. That's often important if you're copying and pasting objects, sometimes you don't want a Tool Tip on an object when it's on the New Layout, so you've got to watch out about that. So having that Show Option can go, Oh, I didn't mean to have a Tool Tip there, I'll take it off. So let's go hover over this and hopefully see Aida Osborne's information, good. And if we go to the next record we'll see whoever's next after that. Now we need to look at a situation. What if we're on the last record and it tries to look. It's going to give us a bunch of question marks, and I don't think that's a very good result for a user. So let's go into Layout Mode, we'll click on that button again, Set Tool Tip, and we need to put a Case statement in, and you might think we need to check to see if the GetNthRecord is empty, but actually what it's going to give you is a question mark, so you've got to realize that, and you saw it in that result there, it gave you a whole bunch of question marks, so you have to check one of these values and see if it gives us a question mark. So we're going to say GetNthRecord, and I always like to check something like the Customer ID, the Primary key, and then we'll say At Next Record close paren equals quote question mark quote. If that's true put something like There is no next record. There we go, semicolon, come down and close off our Case statement, there we go, and that should do it. And I'm actually copying this to the Clipboard with the Keyboard command, after we test this out we're going to put it on our Previous button. So we'll go to Browse Mode, hold it over there, there's no next record. Let's go to the previous one and make sure it gives us ABC Company, good. So we're looking pretty good there. Let's go into Layout Mode, click on this button, set our Tool Tip, and now you're going to see the real advantage of the Let function. Imagine having to go to each one of these and change it. We just have to come up here and say minus 1, and probably we should have named this better, Next Record. I'll live with that because I don't want to change it everywhere I see here, but if I'd named this better I wouldn't have to change this either. I could have called it just At Record or something like that. But see how easy it is. I don't have to change in all these spots and it's just going to work automatically, and we have to say, There is no previous record. How about that? So we have to change it in two spots. Let's click OK, go to Browse Mode, hover over that and you can see that we see Matthew and apparently he doesn't have any address. Let's go to some people we know here, and so now we're on Aida, we should see John, and you can see it's right on there, and if we look at the previous record when there is no previous it says, There's no previous record. So there's your introduction to GetNth Record. Remember the key is it can look at any field inside the Found set from any record. That's really the, really the shining point, or the really, the advantage of this function. It can look at any record in the Found set and grab any field off of it, and that can be real handy, believe me. It'll really help you out in some more advanced techniques.
Tutorial Information
| Course: | FileMaker Pro 10: Intermediate |
| Author: | John Mark Osborne |
| SKU: | 33926 |
| ISBN: | 1-935320-19-X |
| Release Date: | 2009-01-05 |
| Duration: | 15 hrs / 177 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 