Jump to content
Sign in to follow this  
George

Halt script

Recommended Posts

I have a script that is originally called from another related file. Job_hdr has a button that calls an external script in Job_items. This button performs a find on the child records and prints a report. I want to display a message box that no records were found and the user be taken back to the originating form. I have the following code in the external script:

Set Error capture [on]

Allow user abort [off]

Print setup [restore, no dialog]

goto layout ["commission report"]

perform find [Restore]

If["Status(currenterror)=401"]

showmessage["There are no records to print"]

Open["Job_Hdr.fp5"]

Halt script

EndIf

Sort [Restore,No dialog]

Enter Preview Mode[Pause]

Print[]

Enter Browse Mode[]

Open["Job_Hdr.fp5"]

Perform script[subscripts,External: "job_hdr.fp5"]

The script correctly tests if any records match my find criteria and produce the message box as desired, it is just when I click on the "OK" button of the box I expect to be taken back to the job_hdr.fp5 file; instead I am left in browse mode of the commission report screen of job_items.fp5.

Any help appreciated.

Share this post


Link to post
Share on other sites

Hello:

Sounds to me like you need another script step that maximizes job_hdr.

Make a script in the job_hdr file to toggle window (maximize) - I also like to use refresh window (bring to front).

Then, put in this external script in place of "Open["Job_Hdr.fp5"]" (you won't need it because the file is already open).

If I understand your prob, this should help.

Ken

Share this post


Link to post
Share on other sites

Thanks for the reply Ken. I actually got your suggestion to work by adding it to another script step in job_items and then calling it from within the original script.

 Set Error capture [on]

Allow user abort [off]

Print setup [restore, no dialog]

goto layout ["commission report"]

perform find [Restore]

If["Status(currenterror)=401"]

showmessage["There are no records to print"]

perform script [sub-scripts, "no records"]

[color:"red"] Else

Sort [Restore,No dialog]

Enter Preview Mode[Pause]

Print[]

Enter Browse Mode[]

Open["Job_Hdr.fp5"]

Perform script[subscripts,External: "job_hdr.fp5"]

End If


Share this post


Link to post
Share on other sites

In general, I would not throw in the Open() step in a script. If the file isn't open, the call will open it. The step causes FM to search the network every time it its run, EVEN IF THE FILE IS ALREADY OPEN! This can result in a 5-10 second delay in the execution of the script. I like to open all needed files, except security files that need to be protected, upon startup.

-bd

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.