Jim_Shelton Posted March 31, 2008 Share Posted March 31, 2008 This script works except when no records are in the found set. In the cases where there are no found records the script goes directly to the Original Layout and skips the go to GVNoJobs steps. thanks Jim Set Error Capture (on) Allow User Abort (off) Show Custom Dialog (Title: Specify Date or Range of Dates"; Message: "Specify a date or range in which Orders will be searched." Buttons: "OK"; Input #1: JobTicket3::zDAteWorked1, "Date Worked"; Input #2: JobTicket3::zDateWorked2. "Date Worked") Go to Layout (GVLogSheet (JobTicket3) Enter Find Mode Set Field (JobTicket3::GV DateWorked1; JobTicket3::zDAteWorked1 & "..." & JobTicket3::zDateWorked2) Perform Find Sort Records (Specified Sort Order: JobTicket3::DAteWorked; based on value list: "Job Status Booked Sales") Enter Preview Mode Show Custom Dialog (Title: "Print"; Message: "Would you like to print the report?" Buttons: "Yes". "No Jobs" If (Get (LastMessageChoice) = 1) Go to layout (GVLogSheet (JobTicket3) Enter Preview Mode Else If (Get (LastMessageChoice = 2) Go to Layout (GVNoJobs (JobTicket3) Enter Browse Mode End If Print Setup (Orientation: Landscape; Paper Size 8.5" X 11") Print Go to Layout (Original Layout) enter browse mode Quote Link to comment Share on other sites More sharing options...
touchMe Posted March 31, 2008 Share Posted March 31, 2008 Jim, you need a step in your script after PERFORM FIND if(currentError)=401 do this, do that... and exit script else, contune with script Quote Link to comment Share on other sites More sharing options...
Jim_Shelton Posted March 31, 2008 Author Share Posted March 31, 2008 Okay that helped but script does not print if No Records are Found. It goes to correct layout, GVNoJobs and goes through print setup, then goes to last script step. Does not print under top condition. Prints is second conditionis met. Here is latest script. Jim Set Error Capture (on) Allow User Abort (off) Show Custom Dialog (Title: Specify Date or Range of Dates"; Message: "Specify a date or range in which Orders will be searched." Buttons: "OK"; Input #1: JobTicket3::zDAteWorked1, "Date Worked"; Input #2: JobTicket3::zDateWorked2. "Date Worked") Go to Layout (GVLogSheet (JobTicket3) Enter Find Mode Set Field (JobTicket3::GV DateWorked1; JobTicket3::zDAteWorked1 & "..." & JobTicket3::zDateWorked2) Perform Find If (Get (LastError) = 401) Go to Layout (GVNoJobs (JobTicket3) Enter Browse Mode Sort Records (Specified Sort Order: JobTicket3:AteWorked; based on value list: "Job Status Booked Sales") Else If (Get (LastError ≠ 401) Go to Layout (GVNoJobs (JobTicket3) Enter Browse Mode Sort Records (Specified Sort Order: JobTicket3:AteWorked; based on value list: "Job Status Booked Sales") Enter Preview Mode End If Print Setup (Orientation: Landscape; Paper Size 8.5" X 11") Print Go to Layout (Original Layout) enter browse mode exit script Quote Link to comment Share on other sites More sharing options...
Ender Posted March 31, 2008 Share Posted March 31, 2008 Okay that helped but script does not print if No Records are Found. If it's not in a record, what would you have it print?? Quote Link to comment Share on other sites More sharing options...
touchMe Posted March 31, 2008 Share Posted March 31, 2008 you're almost there... you need to exit the script IF the error is 401, ie; no records in found set... and that is the end of the routine ELSE you continue with the script (coz records are there for print), the double negative =/?401 should not be there... if you don't not do this = ? Quote Link to comment Share on other sites More sharing options...
touchMe Posted March 31, 2008 Share Posted March 31, 2008 EXTRACT from script that worked other than where no recs are found... ... Enter Find Mode Set Field (JobTicket3::GV DateWorked1; JobTicket3::zDAteWorked1 & "..." & JobTicket3::zDateWorked2) Perform Find Sort Records (Specified Sort Order: JobTicket3:AteWorked; based on value list: "Job Status Booked Sales") Enter Preview Mode Show Custom Dialog etc., Same EXTRACT with proposed changes... Enter Find Mode Set Field (JobTicket3::GV DateWorked1; JobTicket3::zDAteWorked1 & "..." & JobTicket3::zDateWorked2) Perform Find If["Status(CurrentError)=401"] Show Message ["Jim, no records have been found when I tried to perform a find, what would you have FMP do?] Exit Script End if Sort Records (Specified Sort Order: JobTicket3:AteWorked; based on value list: "Job Status Booked Sales") Enter Preview Mode Show Custom Dialog etc.,... Quote Link to comment Share on other sites More sharing options...
Jim_Shelton Posted April 1, 2008 Author Share Posted April 1, 2008 but the user needs to print and turn in a sheet that states No Jobs Today. Jim Quote Link to comment Share on other sites More sharing options...
touchMe Posted April 1, 2008 Share Posted April 1, 2008 so create a layout for print that says... no jobs for today (in whatever format you wish), remove the silly message thing I put in, have your script print that layout in its place and then take the user to the screen (find, all records, menu etc.,) that best suits the work flow, then... Exit script I would use a sub-script that kicks-in if no recs are found, only coz I like coding things the long way for checking errors Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.