My.ADVISOR.com Sign-In
Username
Password
Sign Up 
Go to Article
Advanced Search 

ADVISOR ANSWERS

Polish FileMaker Pro Solutions with Scripting

Want to spiff up a solution? Scripting is the answer. Find out how scripting can help your solutions look great.

By Lee Lukehart, Soliant Consulting director of training

UNLOCKED -- This article is provided to subscribers of FILEMAKER PRO BASICS ADVISOR or DATABASED ADVISOR or FILEMAKER PRO BASICS ADVISOR. To subscribe or renew, go to Advisor Store.

Q: I recently inherited the responsibility for a shared FileMaker Pro 8 database used by six others in my company's customer service department. My co-workers are hinting that they'd like to have a little more "polish" put on our system, specifically in automating our reporting process. I suspect the answer lies in better scripting, but there are so many script functions and I'm not sure where to start. I'm comfortable editing layouts, defining buttons, and writing simple scripts. Can you provide any pointers, please, to make generating reports a little slicker?

A: Your intuition is right on the money. Scripting in FileMaker Pro lets you automate workflow, interact with the user, and create responses based on that input and other conditions, such as current date, number of records found, or identity of the logged in user. For a detailed look at scripting in action, see Paul Mitchell's article, "Automate Navigation with FileMaker Pro Open Scripts." You've already done some scripting, so you know the basic premise is quite straightforward: open ScriptMaker from the Scripts menu, create a script, and add a series of script steps that achieves the desired outcome. Ah, but which steps to use, and how to best apply them? With more than 130 script steps to choose from, there's the rub, as Shakespeare's Hamlet would say. Additionally, many script steps can directly access the specify calculation dialog -- providing a powerful synergy that creates infinite options to craft the outcome you seek. I'll suggest a few script steps that are popular hard workers, and demonstrate how they can work well together.

One way you might automate and polish your co-worker's reporting workflow is to intelligently guess the dates for the report. Let's say every week each of your co-workers runs a month-to-date report of customer service requests they've received, summarized by category. To select the records for their report, they currently must do a manual find on two fields: RecordCreatedDate, the date the customer service request was created, and RecordCreatedBy, containing the FileMaker Pro file login (account name) of the employee who took the request. Then they click a button on your report menu that prints the report. You want to revise that behavior to automate the find, but also let the user customize the date range before running the report. Also, you don't want running the report to disturb the current found set of records. For a little added functionality, you'll even let the user customize the report title that prints at the top of the report.

To get a clear idea of the process you'll need to create, it's useful before opening ScriptMaker to write out the sequence of steps in general terms -- sometimes called pseudocode. A script for the proposed scenario might proceed as follows:

User starts script from a button or the Scripts menu.
1. Present a Custom Dialog with OK and Cancel buttons, and three pre-filled entry fields:
- Start Date (first day of the current month, or last month if today is the 1st)
- End Date (yesterday's date)
- Report Name ("MTD Customer Service Summary")
2. If user clicks on Cancel, end the script. If user clicks on OK, Open a New Window (so user's current window remains undisturbed).
3. Go the layout for the desired report.
4. Find current user's records within date range from the Custom Dialog.
5. Sort as needed.
6. Preview the report.

To accomplish this workflow, the script steps you'll want to use, among others, are:

Show Custom Dialog
If / End If
Enter Find Mode
Set Field
Perform Find

You'll also need three global fields -- two of field type Date and the third as type Text -- to hold the search start and end dates and custom report name entered via the Custom Dialog. Regular fields would work, but the advantage of global fields is that you can temporarily store data without concern about which record you're on or move to.

TIP
If you haven't used a global field before, just think of it as a regular FileMaker Pro field (text, number, date, time, timestamp, or container) whose content is shared by all records. If the value of a global field changes in one record, that value is immediately available to all other records. In fact, the content of a global field is available to any record in any table in your file -- even unrelated tables -- and it can also be shared across files if at least one relationship exists between them. You can make a field global when you're defining fields in the Define Database dialog (Manage Database in FileMaker Pro 9). Select the field name and click on its Options... button. Select the "Use global storage" checkbox under the Storage tab to make this a global field.

Polish Solutions with Scripting

No reader comments ... yet.

    What do YOU think about this topic? Share your advice and thoughts using this form.

    Your Name

    REQUIRED : PUBLIC

    Your E-Mail

    REQUIRED : PRIVATE

    Job, Company

    OPTIONAL : PUBLIC

    City, State, Country

    OPTIONAL : PUBLIC

    Your Web Site

    OPTIONAL : PUBLIC

    Your Comment

    Please help everyone by keeping your comments on-topic, using clean language, and not defaming or making personal attacks.


    Your e-mail address is required, but it will not be displayed to the public or given to anyone. See our Privacy Policy. Comments become visible after they pass our spam filter, and spammers and abusers are permanently blocked. Please report spam or abuse.

    Lee Lukehart is director of training for Soliant Consulting, an FBA Platinum Member. Lee is a FileMaker authorized trainer, Developer Conference speaker, and FileMaker 7/8/9 Certified Developer -- and was juggling data even before he caught the FileMaker bug in 1986.

    Printer-friendly
    page layout

    Keyword Tags: FileMaker, FileMaker FileMaker Pro, FileMaker Users

    ADVISORAMA
    Why is lemon juice made with artificial flavor, and dishwashing liquid made with real lemons?
    -- George Carlin

    ARTICLE INFO

    FileMaker Pro Basics Advisor

    Web Edition: 2008 Week 09, Doc #19386

    Print Edition: Issue #13, Page 6

    SUBSCRIBER ONLY ARTICLE LOCKED

    New Publication for FileMaker Users

    ADVISOR BASICS
    of FILEMAKER PRO

    Get fast, easy help on using FileMaker Pro database software. Learn the basics, follow the steps, enjoy the results!

    Act now to get the special Charter Subscriber offer.

    Read the fast-track to learning and using FileMaker Pro

    Subscribe to FileMaker Advisor Magazine

    Read the advanced guide to creating custom business database solutions with FileMaker software. Subscribe now to gain access to all the archives and downloads.

    FileMaker.Advisor.com

    Subscribe to Advisor Basics of FileMaker Pro

    Learn the fundamentals of using FileMaker Pro software. Every issue gives you step-by-step instructions on creating the databases you need. Subscribe now!

    FileMaker.AdvisorBasics.com

    Free E-Newsletters

    Keep up! Hot News, How-To, Tips & Tricks, Expert Advice, and more. Click to request your's free.

    AdvisorUpdate.info

    Need Know-How Now?

    What direction are you going with your business? Advisor Guides are packed with the answers you need to work smarter. Can you afford to fall behind?

    AdvisorStore.com

    Showcase Your Smarts

    Submit your tips, techniques and advice and let Advisor promote your business and build your career. Show the world what you know!

    AdvisorTips.com

    Use of this or any other site, content, product or service of Advisor Media constitutes acceptance of Terms of Use.
    Portions copyright ©1983-2008 Advisor Media, Inc. All Rights Reserved.
    Reuse or reproduction of any portion or quantity of Advisor Media's copyrighted content, in any form, for any purpose, requires written permission.
    ADVISOR®, the ADVISOR logo, and other names and logos that incorporate ADVISOR are registered trademarks, trademarks or service marks of Advisor Media, Inc. in the United States and/or other countries.
    Other trademarks are used for identification, editorial or descriptive purposes and are the property of their owners.
    lukel002-03 posted 02/25/2008 modified 05/12/2008 03:43:58 AM ztfmfu/ztfmfu
    domino-144.advisor.com my.advisor.com 05/16/2008 02:53:09 PM