Categories
FileMaker Tips

The Economics of FileMaker 7 Scripting

ToolBoxIcon_smallIn my first really large-scale FileMaker 7 development project, I have created over 600 scripts. This is not something I am proud of. I would love to have 200. The more I use 7, the more often I consolidate script functionality into generic scripts driven by script parameters. You can save yourself a lot of scripting time by writing one script instead of 10 or 20.

Print Setup. Here’s a quick example. In FileMaker 6 and earlier, I always had a script for each print setup option. At minimum that would be Vertical Letter, Horizontal Letter and #10 Envelope. I then put a script step into each script that is supposed to print that performs one of these scripts.

No more. Now I use one print setup script and reference the single script with a script parameter to select the print setup option I want. In my single script, I use an If – Else If construction. Once you have an Else If section including the Print Setup step built, you can just highlight it and duplicate it as many times as you need Else If sections. Then just modify the script parameters and print setups right there.

If ( Get (ScriptParameter) = “Vertical Letter”
Print Setup [Restore; No Dialog]
Else If (Get (ScriptParameter) = “Horizontal Letter”
Print Setup [Restore; No Dialog]
Else If (Get (ScriptParameter) =#10 Envelope”
Print Setup [Restore; No Dialog]
End If

Go to Related Records. Here’s another example. In my FileMaker 6 solution, I had about 10 scripts in my Contacts file that would go to related records in other files. In my 7 solution, I replaced these 10 with a single script using script parameters with If – Else If again. I run this single script with the parameter as my code to tell the script which Go To Related Record step to run.

Reports usually have similar construction, so I can often lump several report scripts into one again using the If-Else If construction with script parameters. My FileMaker guru friend, Ted Fehlhaber, has been known to do all reporting with a single reporting script. I’m not that rigorous, but maybe he’s on to something.

I do have one *extra* script called Preview-Print-Return that I run at the end of my report scripts so that I can avoid entering the same steps over and over again. I also have an *extra* script that saves my place at the beginning of the report script and an *extra* script that checks to see if the user has enough privileges to run the script at all.

Extra generic scripts are generally scripts well spent. It’s the unique, single-use scripts that I look for ways to eliminate or consolidate. It’s worth pausing for a couple minutes now and then to see where generic scripts using script parameters can get the job done more economically.

1 reply on “The Economics of FileMaker 7 Scripting”

Hi. I am currently using HyperCard on an SE30 for my property management business; I do my accounting and have other databases. I am going to attempt to create something in Filemaker for accounting etc. One thing I did with HyperCard was to have “recurring entries”, for example, tenant rent. I had set up a database with tenants’ rent in it by shopping center, and was able to do a HyperCard script that would copy the info from the rent database and put it into a general journel page. From there I would post to A/R, and geneneral ledger. I am hung up on figuring out how to do the same thing in Filemaker; that is copying rents from one file into another. Any ideas, or examples. Thanks. John Hudson.

Leave a Reply to John Hudson Cancel reply

Your email address will not be published. Required fields are marked *