We will be undergoing scheduled maintenance on May 20th, 2013 at 02:00 GMT.
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.
We have one more script to write for our Multi-User Preferences. This script isn't required but it's going to make your life really easy. Right now we have one record in accounts for Admin, but as you remember in our Security we actually have an account for User1 and User2 and we might add User3, User4, User5. We don't want to have to come into Accounts every time we add a new account and come to the ACCOUNTS Table and add them in here. We might forget it, it's just a pain, we don't want to do that. We can have the system automatically do that for us in the Open Script. So we'll come in here to our Open Script and we'll start by changing this to our Layout ACCOUNTS Preferences. There it is, right there. And you notice it's attached itself to the ACCOUNTS Customers Table Occurrence so it really doesn't matter for the most part. You just have to remember that and make sure when you're doing things that you specify fields inside of this Table Occurrence rather than ACCOUNTS Invoices or ACCOUNTS Products, but they're showing the same records. As far as looking at records it makes no difference which one, it's really through the Relationships, so when we do that make sure you refer to ACCOUNTS Customers if that's where we're at. So what we're going to do is enter Find Mode, take the Pause off, Set Field and here's what we have to worry about. We don't want to choose ACCOUNTS Invoices or Products, we want to choose ACCOUNTS Customers here to make sure we search in the right context, so we're going to come in here and look at the account name and then in here we're going to put get accountname. That will get the account name that's logging on and it'll do a Find, once we do the Perform Find. So we'll go locate that, move that in there, so it's going to go, Enter Find Mode, put that criteria for the Current Account in there, Perform the Find and either we're going to find a record or not. Now, what we do want to do is come in here and before we go on with the IF statement here is make sure that we put on this criteria: quote equals equals quote ampersand. That's in case two accounts are close to each other we don't get some kind of mistake here of finding two records and somebody starts modifying the other person's account. That's a little safety net there. So when they perform the find they'll either locate records or not. So we'll say: If the LastError equals 401, if that's the case they have no record in there and we want to create it. We're already in the right context so we'll create New Record, it'll create a record in ACCOUNTS and then we can do our Set Fields. So what we're going to do is we're going to set our account, right there, we're going to set that to get accountname. There we go. Duplicate that. And these Set Fields are going to set the initial values for these, Startup Layout, we'll set that to Customers and then we'll duplicate that and we'll come in here and say Category to the most common choice and we'll decide that that's Commercial. There we go. So, once we've done that then we're fine, so either we do that or we don't. It's up to you. Did we find record and if we find one record we don't do that, if we don't find any records we do that, either way we're going to end up on that particular person's, that account's record. Doesn't really matter at this point but you need to know that in case you need to do something at this point with that account information. Maybe you want to store something else here about their account, maybe every time they log on you could do that. So, the next thing we want to do is Go to Layout and we're going to choose to Go to Layout CUSTOMERS Form. And I could have chosen CUSTOMERS Invoices or CUSTOMERS Products, I want to make sure I'm in the right context for the next thing I'm going to do because the next thing I want to do is go to the right Startup Layout. That was the field we changed up here, or the step we changed up here, we want to make sure we're doing that correctly here. So, what we're going to do is go to Layout Name by calculation, not Layout. We're going to go over to the correct ACCOUNTS, not ACCOUNTS Invoice, not ACCOUNTS Products, but ACCOUNTS Customers, find that Startup Layout and concatenate on what we did before, underscore Form. Because we're in the right context we know we're on, we don't care what Customer record we're on because we're on that Customer record and it's got the same account, Current Account on it everywhere, it'll be able to grab the right information and go to the right Startup Layout so it may not be CUSTOMERS, it may be INVOICES. And then it'll do all the rest of the stuff we did before. So we'll go ahead and save that, we'll close that and let's go ahead and open up with the User1. We'll double-click on this, 1234 is the password for that and then user1. We'll click OK and remember, we won't get this if we have Set Error Capture on, so for some reason this one doesn't have that so we'll hit Continue. You'll see that it's created the records. It's actually gone to the INVOICE, but let's go under Preferences with the Admin account. Let's log back on and see what happened. 1234, go in here, we'll go over to Preferences and you see we're on the Admin one but let's go ahead and see what happens if we go to the other record. So we just reversed it and you see it's User1 and it's got all the information on there so it set that up correctly. Now let's go ahead and look at Manage Scripts and see what our Set Error Capture says here. It looks like On and Off and I'm not sure why that went ahead and gave us that error message. It shouldn't have - ah! Well, that's why. Because we don't even have that running on here. So, we can figure these things out as fast as they come up. So let's put on, in fact, we'll put on Allow User Abort also. Duplicate that, make it Set Error Capture. So that's why we got that error message. Now it won't happen and you won't see that Cancel or Continue button. So, there's that last script which will make things much easier on your life. I highly recommend adding it if you're using this Multi-User Preferences technique.
| 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 |