George Posted August 16, 2002 Posted August 16, 2002 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.
kenneth2k1 Posted August 16, 2002 Posted August 16, 2002 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
George Posted August 16, 2002 Author Posted August 16, 2002 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
LiveOak Posted August 17, 2002 Posted August 17, 2002 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
Recommended Posts
This topic is 8139 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now