Category: Get

Syntax: Get ( LastError )

Parameters: None

Data type returned: Number


Returns the number of the error generated by the most recent script step. If there was no error, then Get (LastError) returns 0. Use this function in combination with Set Error Capture [On] to trap and handle errors raised in scripts.

A common source of bugs in scripts is not remembering that the Get (LastError) function returns the error code from only the most recently executed script step. For example, in this script

 Perform Find
 If (Get(ErrorCaptureState) = 1)
 Show Custom Dialog (Get (LastError))
 End If

the Get (LastError) step returns the result of the execution of the If statement, not the error code generated by the Find step.

Note that if a script is running on the Mac OS and calls an AppleScript routine, any errors generated will also be passed through to and presented via this function.

Note too that if an error occurs in FileMaker while performing an SQL query, an SQLSTATE error will be returned by ODBC.


Consider the following script:

 Set Error Capture [On]
 Print Setup[Restore]
 SetVariable [$error; value: Get (LastError)]

If the user cancels out of the Print Setup dialog, Get (LastError) returns 1 (user canceled action). If the Print Setup step executes successfully, Get (LastError) returns 0.

: FileMaker Specifications

FileMaker 8 Product Line

Specifications and Storage Limits

Field Types and Import/Export Formats

: Calculation Functions

Working with Calculations Primer

Calculation Signatures

Calculation Functions

: Custom Functions

Custom Functions Primer

Useful Custom Functions

: Script Steps

Scripting Primer

Script Step Reference

: Quick Reference

FileMaker Error Codes

FileMaker Keyboard Shortcuts

FileMaker Network Ports

FileMaker Server Command Line Reference

FileMaker XML Reference

: Other Resources

Where to Go for More Information

show all menu

FileMaker 8 Functions and Scripts Desk Reference
FileMaker 8 Functions and Scripts Desk Reference
ISBN: 0789735113
EAN: 2147483647
Year: 2004
Pages: 352
Similar book on Amazon © 2008-2017.
If you may any questions please contact us: