Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Script not functioning if found set is zero records


Jim_Shelton

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 = ?

Link to comment
Share on other sites

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.,...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.



×
×
  • Create New...

Important Information

Terms of Use