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.
To finish up this solution for Duplicate Record Prevention we need to add four new scripts and we're going to start with the main script right here and let's remind you what it does right now. So let's go into Layout Mode, double-click on it and you can see it just a Go to Related Record that says: Go to Customers, using the CUSTOMERS Form layout, show it in a New Window, put the Customer Name in there and you know, offset it a little bit. We'll do the same thing inside the script but we need an actual script now because we need to do quite bit more. So let's go back into Browse Mode and we'll go into Manage Scripts and we'll make a New Script. We'll call it Add Customer from Invoices and I'll put some brackets there, there we go. We'll do Perform Script, Allow User Abort, Set Error Capture and then we'll start off with an IF statement. We have to decide are we going to do what we were normally doing, which is show the customer, or are we going to try to add a new customer because it's blank already. So, we'll say, Not IsEmpty go find out kf customer id and that's it. Simple as that. If it's got something in it then we're going to say Go to Related Record and do what we had before. So we'll go to CUSTOMERS using the layout CUSTOMERS Form and then Show a New Window, we'll Specify from CUSTOMERS. We'll go to name full and then we'll come in here and put get windowtop plus 30 and get windowleft plus 30. There we go. And we don't need to Show Only Related Records. This is good. Now we've got exactly what we had before but we need an Else statement in here to do what if that customer ID is empty? So we'll come in here and say: Set Field, because the first thing we're going to do is initialize those Global fields, so remember those Global fields we added in the GLOBALS table, xname first and xname last? We need to initialize those so when we show the Custom Dialog they're empty. And we'll change this to xname last and there we go. Now we can show our Custom Dialog and it will be blank, won't have the values from the last time you did this, and we'll put in something like: Enter Name. Enter the first and last name of the customer. That looks good. And we'll keep our OK and our Cancel buttons here because we'll want to give them the chance to continue or not. We'll click OK here. Or, actually, before we click OK we can't forget our Input field so we need, from GLOBALS our xname first, we'll put First Name here so they can identify the field and here we'll put xname last and then type in Last Name. OK, now we're done and we can click out of here. So if they click OK which is the first button then we're going to say: get lastmessagechoice equals 1. So that's for the OK button. If you remember, we just did it, OK is right there. So that's this IF statement to this End If right here. If they click Cancel, which is button2, it'll just go right to the End If and do nothing, so that's exactly what we want here. So, but if they click OK then we're going to create a New Window, move that over and let's give it a name. We'll call it Customer and, again, we'll offset it: get windowtop plus 30, get windowleft plus 30. There we go.
| Course: | FileMaker Pro 11: Advanced |
| Author: | John Mark Osborne |
| SKU: | 34140 |
| ISBN: | 1-936334-36-4 |
| Release Date: | 2010-07-09 |
| Duration: | 14.5 hrs / 159 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |