filemaker pro 11 the missing manual phần 10 pps

97 562 0
filemaker pro 11 the missing manual phần 10 pps

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

795  :   Scripts and Security If you want to secure a scripted process, then the extended privilege feature de- scribed on page 788 is safer and lets you much more easily update accounts and privilege sets. Handling Security Errors If your script tries to do something the person isn’t allowed to do, then FileMaker shows the error message in Figure 18-21. If you turn error capture on in your script, then this error doesn’t show on the screen. Instead, you can use the Get ( LastError ) function to check for an error (see page 694). That way, you can have the script dis- play a custom message box, email you the name of the misbehaving person, or take some other action. The most common security-related error is number 200: “Record Access is Denied.” (If you’re interested in learning more about error codes, check out the resources in Appendix B: FileMaker Error Codes.) Figure 18-21: When someone tries something your security setup doesn’t allow, he sees this message— even if it’s a script that’s breaking the rules. Unfortunately, FileMaker doesn’t tell him—or you—what the script is trying to do. Running Scripts with Full Access Privileges Sometimes you want the script to do its duty even though the user doesn’t have the necessary privileges. For example, you may want to remove an accountant’s ability to delete invoice records since she’s not supposed to delete any orders. But you may still want to let her run a script that finds old completed invoices, exports them to an archive, and then deletes them. Since this script is careful to delete only invoices that are ready to go, the accountant can safely run it when necessary. For those kinds of circumstances, FileMaker lets you specify when a script should run with full access privileges for anyone. In other words, the script overrides the normal restrictions you set up in the user’s privilege set. At the bottom of the Edit Script dialog box, just turn on the “Run script with full access privileges” option. With this option turned on, the script dutifully deletes the invoices even though the accountant running it isn’t allowed to delete records in the Invoice or Line Item tables with her account’s privilege set. Even when you set a script to run with full access privileges in this way, you can still prevent some folks from running it by switching it to “no access” in the Custom Script Privileges window for a privilege set (page 779). You can also make the script check for an extended privilege, and then take appropriate actions for different people. 796 FM P : T M M Scripts and Security Note: The Get ( PrivilegeSetName ) and Get ( ExtendedPrivileges) functions may not give you what you expect if you use them while a script is running with [Full Access] privileges: The user’s real privileges don’t show up; the functions return [Full Access] info instead. Use Get ( AccountPrivilegeSetName ) and Get ( AccountExtendedPrivileges ) to get info about the account that opened the file. Managing Security with Scripts The Edit Script window (page 417) has an entire section called Accounts. It includes six steps that give you some control over the security system from your scripts. All these steps require full access privileges to work. If you don’t manage a lot of ac- counts in your database, then you might not find much use for these steps. But if you have a large organization, or one that has lots of turnover—like a school system that’s constantly adding new teachers or graduating a whole class of students who no longer need access to databases for class work—these script steps can save tons of time and effort. Add Account FileMaker lets you add new accounts to a database from a script—and for good reason. If you build a system that uses several databases, and you can’t use external authentication, then the Add Account step is your best friend. Instead of adding each account to all your files manually, try this: Write a script that asks for the ac- count name and password with a custom dialog box, and stores them in global fields. Then use scripts in each file to add the same account to every file at once. When you’re all done, be sure to clear the password from the global field to protect it from prying eyes. Or, if you have to populate your brand-new file with a huge number of people when you’re first installing your database, then you save tons of time creating accounts if you have an electronic list of user names and passwords. Import them (page 826) into a table, and then use a looping script (page 443) to create hundreds of accounts in a few seconds. Tip: The Add Account step lets you specify the account name and password using calculations, but you have to select a specific privilege set for all users in the loop. If you want to script the creation of accounts with different privilege sets, use the If/Else If steps and several copies of the Add Account step, each with a different privilege set selected. Delete Account If you’re going to create accounts with a script, why not delete them, too? The Delete Ac- count script needs only an account name—and you can supply it with a calculation. With this script, you can build the other half of your multifile account management system. 797  :   Scripts and Security Warning: If you write a script that adds or deletes accounts, then pay special attention to its security set- tings. You can all too easily give a database the tightest security FileMaker allows, and then leave a gaping security hole through a script. Customize privilege sets so that only you (or a trusted few) can run the script, and don’t put it on the Scripts menu. Reset Account Password If lots of people use your database, then forgotten passwords will undoubtedly be- come your worst nightmare. You could spend all day changing passwords for people. Why not write a script that can reset a password to something generic, and then email it to the person? If you set the script to run with full access privileges, then you can even delegate password resetting to someone else. The Reset Account Password step needs an account name and a new password to do its job. Change Password You’ll probably use this script step only in cases where you’re creating a special lay- out that lets people who don’t have full access privileges manage security. For ex- ample, you may have someone on staff who should be able to manage accounts, but you don’t want him to have full access privileges. So you can build a special layout (or two), and write scripts that run with full access privileges to manage all your security tasks. That way, you can even do special workarounds like allowing some members of a privilege set to change their passwords without giving this power to each of them. To do so, you usually need a user’s table with a field that controls who can and can’t run your Change Password script. Enable Account Once you’ve created a bunch of new accounts using the Add Account step, the En- able Account step lets you turn them on and off at will. That way, you can create accounts for, say, an entire class of students, and later turn on accounts for those who’ve arrived on campus. This step sets the appropriate Account Status, and it works only when there’s a valid account name that matches your script settings. Re-Login The most exciting step in the Accounts section is Re-Login. It provides a function that doesn’t exist anywhere else in FileMaker. It lets you switch to a different account without closing the file, which makes testing security settings a lot more convenient. Instead of opening and closing the files until your mouse button wears out, just run a Re-Login script. Add steps in the script that set global fields on pertinent layouts to Get (AccountName) and Get (PrivilegeSet) so you can keep track of what you’re test- ing as you re-login over and over. To get the most realistic testing conditions, make sure your Re-login script calls any script that runs when your file opens. 798 FM P : T M M Scripts and Security You can also use Re-Login when someone inevitably calls you to his desk to show you a problem in the database. Just re-login as an account with full access, and then you can poke around and find out what’s happening on his computer. When you re-login, you’re not just saving time by not closing and reopening the file: You can actually work in the same window, on the same record, with the same found set and sort order without all the trouble of recreating the situation back at your desk. Tip: If you have a login script that changes that setup, turn on Script Debugger before you run the Re- Login script. Then skip over the parts of the login script that would change that all-important setup. Since you can re-login only from a script, most developers add a Re-Login script to the Scripts menu in every database they create. 799   Sharing Data with Other Systems B uilding a big database can make you feel like a slave to your computer, but the point of a database is to let you manage information more efficiently. Nothing shows this point better than FileMaker’s ability to pull data into your database from various sources, and dump it back out again in assorted ways. If you have data in almost any kind of program—spreadsheets full of figures, lists of names and phone numbers, electronic orders in XML, folders full of pictures or text documents—FileMaker can import it directly into your database. If your data is already in FileMaker, then you can export it to lists, other databases, XML, or almost any other format imaginable. FileMaker takes a wonderfully flexible approach: It lets you handle simple imports and exports with just a click or two, and provides the features to tackle the most complex cases as well—if you (or some hired help) are willing to do the necessary work. If your company uses one of the vast corporate databases—Oracle, Microsoft SQL Server, or MySQL—FileMaker can integrate directly with them, bringing its powerful (and easy) developer tools to bear on their complex-yet-oh-so-speedy data. You can put your corporate SQL data right on the FileMaker layout, perform FileMaker finds, write scripts, and even add calculation fields, all without writing a single line of SQL code. Sharing Your Data with Others Most database systems don’t live in a vacuum. Chances are your information is important to someone else, or important to you somewhere else. You may want to transfer job information to your Accounting software, or send the sales report to your associate across town. Luckily, FileMaker provides options for getting the data out of your database in all kinds of forms. 800 FM P : T M M Sharing Your Data with Others Save/Send Records As If your data is destined for a person (rather than some other computer program), then you want a format that’s easy to look at and to work with on almost any com- puter. FileMaker lets you save your data in two ubiquitous formats, an Excel spread- sheet and a PDF document, and the unique Snapshot Link. Choose Excel if you want to be able to work with the data (perform analysis, combine it with other data, create graphs, and so forth). If you want the output to look just like it looks in FileMaker, and you don’t need it to be editable, then a PDF is the perfect choice. Snapshot links direct other FileMaker users to a particular set of records in your database. Saving as Microsoft Excel If people need to work with the data you send them, but they aren’t lucky enough to have FileMaker, you can create an Excel file for them. (And presumably, if they’re working with data, they have either Excel or a program that can open Excel spread- sheets.) Just choose File➝Save/Send Records As➝Excel. When you do, FileMaker shows the window in Figure 19-1. Figure 19-1: The Save Records As Excel window lets you tell FileMaker where to save the spreadsheet file. It also gives you the option of automatically opening the file you’re creating, so you don’t have to go rummaging around your hard drive looking for it. The Save pop-up menu lets you choose whether you want to save all the “Records being browsed” (that is, the found set) or just the “Current record.” Turn on “Auto- matically open file” if you want to see the spreadsheet as soon as FileMaker finishes saving it. When you do, FileMaker automatically launches Excel and shows you the spreadsheet. You also have the option to “Create email with file as attachment,” so 801  :      Sharing Your Data with Others it’s easy to check your work and create a quick email with the data your boss just asked you to email her. Once you save, FileMaker creates a new email message in your email program, attaches the spreadsheet, and opens the message so you can add recipients, a subject, and any message you want. If you click Options, you can set up some basic details for your new Excel file. For example, you can choose whether you want your FileMaker field names to appear in the first row of the spreadsheet. You can also type a worksheet name and a title, sub- ject, and author (each of which appear in the spreadsheet in the appropriate places). One option you don’t have is which FileMaker fields are included in the Excel file. All the fields that appear on the layout you’re currently viewing (including merge fields) will become columns in the Excel file. Saving as Portable Document Format (PDF) Just about anybody with a computer can view PDF files. With PDF, you get to choose exactly how the data looks, since this format preserves your beautifully crafted lay- outs. With FileMaker’s layout tools, your keen design sense, and the “Save/Send Record as PDF” command, you could use email to distribute invoices, product cata- logs, sales brochures, or annual reports. You can even send vision-impaired people a file their software can read aloud. Even if all you need to do is send people data they can see but can’t change, then a PDF file is just what the software engineer ordered. Tip: The most common PDF viewer, Adobe Reader, is a free download at www.adobe.com/products/ acrobat/readstep2.html. Mac OS X also comes preloaded with its own PDF viewer, called Preview. The basic choices are the same as for Excel. You choose between sending just the current record or the whole found set. And, whether the file opens in a PDF viewer or attaches to a new, blank email just as soon as FileMaker creates it. But behind the Options button you find a much richer set of choices. There are three tabs—Docu- ment (Figure 19-2), Security (Figure 19-3), and Initial View (Figure 19-4). Starting with the Document tab, you can set: • Title. This title isn’t the name you give the file in the dialog box. It’s an addi- tional title that becomes part of the properties of the document. Most, but not all, PDF viewer programs let you see a file’s properties. • Subject. This document property helps you tell a series of similar documents apart from each other. • Author. This document property is usually your name, but may also be the name of your company or department. Again, it helps you organize a bunch of similar files. • Keywords. Some file management programs can search these keywords to lo- cate documents. 802 FM P : T M M Sharing Your Data with Others • Compatibility. Choose from Acrobat 5, 6, or 7 and later. If you think your re- cipient might not have the latest and greatest PDF viewer, pick a lower number. • Number pages from. You can make a different numbering system than the one you have in FileMaker. Keep in mind, though, if your layout displays page num- bers in FileMaker, this setting won’t change them. You could create a document where the PDF viewer says you’re on page 5 but the number displayed on the page is 7. • Include. You can set a limited page-number range with these options, so that only a part of the found set is included in the PDF file. You may have to go to Preview mode in FileMaker first, though, to help you set the page range properly. Figure 19-2: The PDF Options dialog box shows up when you choose File➝Save/Send Records As➝PDF, and then click Options. The Document tab lets you add information to the PDF document. The first four options become part of the document’s properties, as described in the note below. Tip: You can see the PDF file’s Title, Subject, and Author in Adobe Acrobat’s PDF viewer’s Document Properties Summary window. In Mac OS X’s Preview program, choose Tools➝Inspector instead. In the Security tab (Figure 19-3), you can decide how much access you give your recipients when they receive your file. You can choose: • Require password to open the file. Click the checkbox to turn this option on, and then enter a password. This checkbox is useful if you’re selling a catalog and provide passwords only to people who’ve paid to receive it. Then, of course, there’s the standard use; you just don’t want every Malcolm, Reese, and Dewey poking around in your PDF files. 803  :      Sharing Your Data with Others • Require password to control printing, editing and security. Click the check- box to turn this option on and enter a password. You might want your PDF freely distributed, but not so freely used. If so, don’t require a password to open the file, but lock it down so nobody without a password can use the material without your permission. With this option checked, a whole raft of new options becomes available. You can set: — Printing. Choose from Not Permitted, Low Resolution (150 dpi), or High Resolution. These options would protect photographic or other artwork images that you want to send in a catalog but don’t want people to reprint freely. You also may want someone to see your document onscreen, but not print it and risk having it fall into the wrong hands. — Editing. Although PDF files are generally considered view-only, with the right software, they can actually be edited. If you don’t want to allow this (or want to restrict what can be done), choose options from the Editing pop-up menu. For example, if you’re sending a contract for review, and you want to be sure no new clauses are snuck in while it’s away, you can choose Not permitted. — Enable copying of text, images and other content. With this option checked, recipients can copy and paste material from your PDF file. — Allow text to be read by screen reading software. This option lets people with vision or reading problems have their screen reading programs read your document out loud. Seems like turning this off would be pretty uncool. Figure 19-3: The Security tab lets you lock down your PDF file if you need to prevent inappropriate use. Some older PDF reading programs may not recognize all these options. If someone’s PDF reader doesn’t have security features, it can’t open the PDF file at all, so your data is still safe. 804 FM P : T M M Sharing Your Data with Others Note: Looking for absolute, iron-clad control of your information? Handwrite it on paper and store it in a secret vault. Vast amounts of money and time have been spent trying to secure digital information from unauthorized access and reuse. Ask the record companies how that worked out for them. The old chestnut about the lock only keeping the honest man honest applies here, too. PDF security settings are deterrents to unwanted use of your intellectual property, but they’re all surmountable. When you use these tools, you’re managing risk, not eliminating it. The final tab in the PDF Options window is probably the one you’ll use the least. But if you like to control which PDF viewer options are visible when your recipient first opens your PDF file, then Initial View (Figure 19-4) is the panel for you: Figure 19-4: You get to decide what the user sees when she first opens the PDF containing your database info. Once again, not all these options work in older versions of PDF software, so consider your settings here a suggestion. • Show. Your choices include Page Only (just the FileMaker layout, with no extra tools or panels), Bookmarks Panel and Page, or Pages Panel and Page to offer viewers some navigation options. • Page Layout. Control the way the PDF viewer displays multipage documents. If you choose Default, your recipients’ preferred view remains in force. But you can also specify Single Page, Continuous, or Continuous-Facing. • Magnification. Here you can define an automatic magnification as either a fixed percentage of the document’s native size or automatically adjusted to fit the window. Warning: These Initial View options may or may not actually take effect, depending on what program and what version of that program the PDF is opened with. [...]... little FileMaker magic to an otherwise bare bit of computer science 816 FileMaker Pro 11: The Missing Manual External SQL Sources If you double-click the table (or switch to the Fields tab, and then select the table from the Table pop-up menu), you’ll see the fields (sometimes called columns by non -FileMaker database folks) from the SQL table listed in italics as well You can do certain things to these... rename the field with a whole lot of X’s at the end of its name When you close the Manage Database window, the field in question will stand out from the list 826 FileMaker Pro 11: The Missing Manual Importing Data Figure 19-12:  Use this dialog box to tell FileMaker what data to import and where to put it In the top-left corner of the window, FileMaker tells you where this data is coming from To the right,... Select the one you want, and then click OK At this point, the exact configuration will vary based on the driver you’re using 810 FileMaker Pro 11: The Missing Manual External SQL Sources Figure 19-7:  The ODBC Administrator on Mac OS X lets you create ODBC data sources You need to log in to your computer as an administrator to create the kind of data source FileMaker needs You also may need to click the. .. appropriate.) 808 FileMaker Pro 11: The Missing Manual External SQL Sources Mac OS X users aren’t so lucky The big database developers don’t provide free ODBC drivers for the Mac Instead, head over to www.actualtechnologies.com/, and then purchase the right driver (they’re cheap and work beautifully) FileMaker, Inc worked directly with Actual to ensure maximum compatibility, and they provide the drivers of choice... it as another record People most often use this format for mail merge in word processing programs • If you want to put the data on a web page, use HTML Table The resulting file isn’t suitable for importing into another program, but it can be displayed nicely in a web browser You can also open the file, copy the HTML table from inside it, and then paste it into another web page • The FileMaker Pro format... connect one FileMaker database to another (see page 592) This time, though, you’re going to connect to a non -FileMaker database 812 FileMaker Pro 11: The Missing Manual External SQL Sources 2 Click New FileMaker shows you the Edit Data Source window 3 In the Name box, type Web Leads You can name the data source anything you want This name will show up when you’re choosing tables to add to the Relationships... names,” FileMaker tries to match fields up by matching their names If your input file has the same field names as your database, this option sets the right order for you The “last order” choice restores the field order you used the last time you imported data Choose “creation order” to see the fields in the order in which you created them Finally, if you manually drag the fields in the list, FileMaker. .. standard Open File dialog box appears 2 Choose the file you want to import, and then click Open The Import Field Mapping dialog box pops up 3 Drag the fields in the target field list on the right so they line up properly with the input data on the left As you drag, you can ignore the field mapping arrows completely You can fix them once you’ve got the fields in the right order Tip: If your data source has... on its own line If the program you’re viewing the file in wraps lines, it might look like a record goes across two or more lines, but there’s a return character at the end of each record, and nowhere else • Each field value is in quotes, and there are commas between them These factors are important because this file conforms to a standard Other programs—including the program used by the card printing... matches the customer’s personality, you can kiss your hard work goodbye when you export In addition to the font, you lose the size, style, and color of the text The notable exception to this rule is the FileMaker Pro format Since this export format creates another FileMaker Pro database, all the formatting you painstakingly put in place is preserved If you must have text styles in your exported data, there . intellectual property, but they’re all surmountable. When you use these tools, you’re managing risk, not eliminating it. The final tab in the PDF Options window is probably the one you’ll use the least about your database that FileMaker uses to recreate the state of the database at the time the Snapshot was taken. • The paths to the database. Yes, that’s plural. The snapshot records your. using the Records➝New Record command, FileMaker sends the right secret code that adds the record to the SQL database. Just type in a field, and then press Enter, and FileMaker updates the SQL

Ngày đăng: 14/08/2014, 08:21

Mục lục

  • Part Five: Integration and Security

    • Chapter 19. Sharing Data with Other Systems

    • Part Six: Appendixes

      • Appendix A. Getting Help

      • Appendix B. FileMaker Error Codes

      • Index

        • Symbols

        • A

        • B

        • C

        • D

        • E

        • F

        • G

        • H

        • I

        • J

        • K

        • L

        • M

        • N

        • O

        • P

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan