AnsweredAssumed Answered

User 'Cancel' fails to return error for Print Setup script step that is set to 'Restore'

Question asked by jbardwell on Dec 16, 2016
Latest reply on Dec 21, 2016 by jbardwell

It seems that Get ( LastError ) would return "1" on User 'Cancel' as occurs other places, including when Print Setup configured to not Restore. Is there a reason Print Setup is different or is this a bug?

 

Issue has been discussed and confirmed in another post on FileMaker Community: "Return" from FileMaker dialogs?

Written up here for FileMaker Engineering Team review.

 

Product and version

FileMaker Adv 15.0.2

OS and version

Windows 8.1 Pro 64bit

Description

When the Print Setup script step include 'Restore' then Get ( LastError ) returns "0" instead of the anticipated "1" when user selects "Cancel" in the Print Setup window.

How to replicate

Create script with the following:

Set Error Capture [ On ]

Print Setup [ Restore;  ]  // dialog displayed allowing User to Cancel

If [ Get(LastError) > 0 ]

     #user cancelled.

Else

     #user clicked OK

End If

The script will always take the Else fork.

 

Workaround

As suggested on a FM Community post "Return" from FileMaker dialogs?, the error can be captured by utilizing two Print Setup steps as shown:

Set Error Capture [ On ]

Print Setup [ Restore; No dialog ]

Print Setup [  ]  // dialog displayed in the second step

If [ Get(LastError) > 0 ]

     #user cancelled.

Else

     #user clicked OK

End If

Outcomes