Home
Username:
Password:
FileMaker Pro 10: Advanced Tutorials

Delete Duplicates / Contacts from Invoices pt. 3




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

Now we're ready to take a look at the master script that controls everything we saw in the previous section regarding this button. We looked at everything that it called and when it went to other layouts but we didn't actually look at this button itself. And let's remind you what it does. If there's something in here and you click on it, it's going to pull up that customer's information. If it's empty, simulating a new invoice and you don't know who the customer is and you click it, you come up with this dialog and it takes you to all those other layouts that we showed you in the previous section. So let's take a look at that script. It's actually two scripts. The first one really is the most complicated one, this one right here and it's New Contact from Invoices. We turn Allow User Abort on or off depending on who's logged on. Set Error Capture on or off depending on who's logged on and then we check to see is the Foreign Key for Customer's ID in the invoices. Does it have something in it? If it does, then we're going to do what we had attached to it before, which is a simple Go to Related Record. Go to Related Record from Customers. In other words, run an invoices layout. We're saying go to Customers from Invoices. It'll go from Foreign Key to Primary Key. Show it on Customers Form. Simple as that. We show it in the window. It's no different than what we did before. But if it's empty, meaning that it's probably a new invoice and they haven't assigned a customer yet, well, then we're going to set our Global Fields to empty. Remember, those Global Fields are in the Global Table; xname First and xname Last. We're going to initialize those and then we're going to show a custom dialog. We're going to say Enter a Name; Enter the First and Last Name of a Contact You Wish to Add with an OK and a Cancel and some input fields: xname First, xname Last. Put those labels in there. You don't have to but it's nice to have them. You know which field is for which. Once you've done that, they either have a choice and we'll go back in here of clicking OK or Cancel. This is one, this is two. If equals one, then we're going to do all this. If it's two, it just goes to the and if and does nothing and cancels out of it, which is exactly what you want. But if they choose one, they want to continue, then we're going to create a new window, call it Customer, offset it. We've done this quite a few times before. We're going to go to the Form New Layout, OK? That's the new layout we talked about that looks like the Customers Form Layout but has a lot of the interface removed. We just want straight data entry. Then we're going to enter Find Mode, we're going to take the values from the Globals and put them into Find Mode. We're going to try to find any customers who might exist with that same first and last name. We'll then perform the find and we really have two possibilities. Either we'll find no records; otherwise we found some records. So if we find no records, Error 41, we create a brand-new record, we place those Global Values into those fields. We're in Browse Mode now because we've performed finds. We take the Global Values, put them into the First Name Field and X Last into Name Last and that initially populates that record with that information so I don't have to type it again. And then we enter the Loop Pause End Loop thing and this is why you see the, all those buttons we showed on the other layouts all have halts on them. That's because we need to halt these scripts because we're going to be either setting up here or ending up here. One of the two possibilities after we've gone all this way; we'll either be here in a Loop Pause or here in a Loop Pause and so we're stuck here indefinitely until we do something. We have to Cancel so that's why all the other buttons have halts on them; because they want to take over from this script and do what we want to do when we create it. Either it's going to select an existing customer or whatever. So remember how that works, the Loop Pause and, we don't want them to hit the Enter Key to continue the script. We want them to hit our button so we can run a new script with a halt on it. So if they do find records, one or more, we're going to go in this section. We're going to say Go to Layout List View New. And we'll save this, look at this script. It's very simple. Just go to Layout Name by Calculation and I usually do Get Layout Name now but you could use Get Layout Table Name and then so get that, so it will be, this is a very dynamic approach to this, even though we won't probably use this anywhere else, I kind of get in the habit of doing it this way. But basically this says that it could work in, from invoices or products to customers, but again we know it's not going to happen that way. So we could have just probably just as easily put just the name in here which would be, it's Customers and it would have worked just the same but who knows. Maybe we'll use it somewhere else. So we'll save that and there we go. And so I made that a modulus script and I'm not sure if I have a very good reason for it other than I might just use it somewhere else at some point. I tend to do that with things I think I might use but I don't think we're going to use that in the rest of the tutorial at all. But, so it's up to you. You could just put a straight Go to Layout here if you wanted to. And then once we get to the List View, that's where we can select a customer that may be it. We have the choice of entering, it says Please Select an Existing Customer. There's no input fields here at all, just this message with one button choice. Then we enter the Loop Pause End Loop thing and that's where you can click on the little, I don't now if we have it. It's a little button on to the left of each record that goes down the list view or we had, over on the right we had a new customer one. Either you can click on and they do different things because you may get all these records displayed and go this isn't the person I wanted to see. This is not the John Osborne I want. This is a completely different John Osborne. So just remember we end up here or here and that's why when we look at these different ones, and we'll go ahead and open this up and go back into Layout Mode and go to these new layouts, we'll see that on this one this Continue Button right here does a halt, runs its own script and then this one right here, this runs a halt because we're selecting that customer and we want to continue on from there and now interestingly enough, this one doesn't have a halt but realize that this script moves over to this layout and then this button does have a halt on it. So we'll eventually halt that script so everything stops the main calling script. The main calling script is just to get you the right place in the first place. Just, the main calling script just gets you to either this view or this view and once we're there, then these buttons do the rest of the work running different scripts.

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