Ultimate Find / Save by Table Occurrence pt. 1
Subtitles of the Movie
One thing I don't like about the Find script is the Show All Records step. When no records are found, we do need some way to get out of that state of 0 records. We've chosen Show All Records, but I'd rather have the Found set restored; in other words, the Found set when the person clicked the button. We have three. I'd like that restored, rather than showing all records. It seems like the better thing to do. Found sets are the basis, the foundation of databases. We might as well take them back and it shows you a really neat technique. You'll have to remember back to the Intermediate tutorial for when we covered this. The basic thing is if you have two table occurrences based on the same source or base table, they can keep separate Found sets. Let me show you what I mean, but first let's show you the table occurrences we've added. So we'll go into Manage Database and you'll see over here we've added a table occurrence called Customers Saved TO, Invoices Saved TO, and Products Saved TO. They're based on the source table of Customers, Invoices, and Products, the same as the ones over here that we might find. For instance, if we're looking at products, we would look at this one. It has the same source table, but they're different table occurrences. In fact, these are attached to nothing whatsoever, no relationships. So let's look at the layouts based on these and let's start by looking at the Found set here. We're on a layout. If we go to Layout Mode and go to Layout Setup, this is based on the table occurrence Customers. If we go to a new layout we've added, which is called Customers Saved, you'll see that it really has nothing on it. We don't have to have anything on it. The important part is Layout Setup. We are based on Customers Saved TO. So if we go into Browse Mode here and we look at the Found set and we change it, let's say we Show All Records, we now have 48. Let's say we'll omit a record and then let's switch back to Form. Well, notice that it has three records found. In fact, Notes is the same way, List is the same way, and Invoices is the same way, but Save is always going to have a different Found set so we can actually use this to our advantage. We can use this to save our Found set temporarily. Now, it's really not a good thing to use our other Save Found Set technique, where we saved the serial numbers. This is a much better way for this situation and we're going to show you many ways to save Found sets. Each one is better in a particular scenario and I think this one works best here because we only need to temporarily save that Found Set until we're done with the Find. So let's go ahead and find out how this works. How do we get this Found Set right here transferred over to our Customers Saved layout? In fact, we have an Invoices Saved and a Products Saved. We have one layout for each one, so how do we get it transferred from here over to here? Well, we use Go To Related Record across a relationship. So we'll take a look t our scripts and we have an example here called Save TO and Restore TO. So this is how we save it. It's called Save TO Test because it's just a test so you can see how this works. We'll come in here and we'll look at it. Now, imagine we're running this script when we're on a layout based on Customers, so we're saying go to related record from Customers to Customers. We're saying go back to itself. It's actually not going through a relationship. It's kind of strange here. And then, even stranger, we say show it using a record based on the Customers Saved TO. Remember, this layout is based on that, so we're saying go to itself, in other words, go through no relationships and then show what the completely different table occurrence is on a layout that has customers saved. That's strange. We'll see how it works. Then we have Show All New Related Records and Match Current Record Only. Well, the idea here is that if we go ahead and say go to related record to itself and then say show a layout with a different table occurrence, it'll actually transfer that found set over there. Strange but true. So we'll save that, close this, and we'll run that script. Saved TO, you see we're over here with three records found. Now we've taken our found set from Customers over to Customers Saved. Simple as that. Now I can destroy this Found Set and still have the Found Set saved over there, so we'll do that. We'll show all records here and now what we'll do is we'll switch back over here. You'll see you have three records. We'll run our restore. It restores that. It's the same idea. It has the same concept here, except that we know that's for later. We want to go to the Restore TO Test, so here's the Go To Related Record. It figures we're on a layout based on Customers Saved TO. It goes to itself, but then transfer that found set over to Customers Form and make sure you have this option on. Simple as that. So we're going to take this concept and show you how to save a found set.
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 