Working with Buttons on Layouts

Table of contents:

Troubleshooting

Lost Error Messages in Scripts

My script is not working properly, but I'm not getting any error messages. Where do I start?

Be sure that you properly account for potential errors if you turn error capture on. What if a find request returns zero records? What if a user doesn't have access to a given layout that is needed for a script? To manage debugging, turn error capture off while you're testing. Some developers write scripts that toggle error capture for all scripts in a system. This is a convenient way to turn on and off a debugging mode.

Unfinished Scripts

I need a script to run to completion without fail. I set Allow User Abort [off], but it appears that the script was aborted at some point by a user. How can I make sure that users can't muck with my scripts?

Remember that turning Allow User Abort off doesn't always save you from errors in the script itself, power outages, the user closing FileMaker Pro, or other random acts of unpredicted computer wonkiness. You can never absolutely depend on a script completing in FileMaker Pro. If need be, write a "check conditions" script in your system and run it when appropriate. Another way to deal with this problem is to write a script log that saves a record when a script starts and another when it ends. You can check for incomplete pairs.

Editing the Correct Related Records

My Set Field script step is just continually changing the first record in a portal instead of the one I want. How do I get the script to act on the proper row?

Be careful when setting fields through relationships. It's possible to think that you're pointing to a single record when you're really pointing to the first of many. In that case, FileMaker blithely applies your script steps to the first related record it finds. Either put a button directly in a portalin which case the script will apply to that rowor use a Go To Related Record script step to explicitly control both the context and the record against which a script operates.

Conditional Error Defaults

My If/Else statement isn't returning the proper result. How can I test what's going on?

Be sure to account for all variations of logic in your conditional scripts. It is strongly recommended that you build If routines that end with an option that you think will never occur.

Here's a quick example:

If [Invoices::Total > 0]
 Do something
Else If [Invoices::Total = 0]
 Do something
Else If [Invoices::Total < 0]
 Do something
Else
 Handle error conditions here
End

This function should never return the default error, but you cannot perfectly predict all such behaviors. For example, what if a calculation for Total is wrong and returns a null or empty value? Or if a calculation you expect to be numeric returns text in some cases?

Testing Loops

My loop seems to be stuck endlessly looping. How do I debug the problem?

It's the rare developer who gets everything right the first time, and if you don't, you might find yourself in the middle of an endless loop. A handy trick is to always create an exit condition that tests whether the Shift key is held down by using the Get( CurrentModifierKey ) function. It's a backdoor out of your loop that's quite handy if you have an error in logic. A much easier way to go if you own FileMaker Pro 8 Advanced is to simply turn on the script debugger the first time you test a new loop.


Part I: Getting Started with FileMaker 8

FileMaker Overview

Using FileMaker Pro

Defining and Working with Fields

Working with Layouts

Part II: Developing Solutions with FileMaker

Relational Database Design

Working with Multiple Tables

Working with Relationships

Getting Started with Calculations

Getting Started with Scripting

Getting Started with Reporting

Part III: Developer Techniques

Developing for Multiuser Deployment

Implementing Security

Advanced Interface Techniques

Advanced Calculation Techniques

Advanced Scripting Techniques

Advanced Portal Techniques

Debugging and Troubleshooting

Converting Systems from Previous Versions of FileMaker Pro

Part IV: Data Integration and Publishing

Importing Data into FileMaker Pro

Exporting Data from FileMaker

Instant Web Publishing

FileMaker and Web Services

Custom Web Publishing

Part V: Deploying a FileMaker Solution

Deploying and Extending FileMaker

FileMaker Server and Server Advanced

FileMaker Mobile

Documenting Your FileMaker Solutions



Using FileMaker 8
Special Edition Using FileMaker 8
ISBN: 0789735121
EAN: 2147483647
Year: 2007
Pages: 296

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net