AnsweredAssumed Answered

loop not working properly on print many records

Question asked by willrollo on Mar 11, 2014
Latest reply on Mar 12, 2014 by willrollo

Title

loop not working properly on print many records

Post

     I have a print script that finds a group of records and then prints the all one after the other. However, the loop seems to end early, with one record not printed... I am not sure why so should be grateful for any advice... the script is below with the loop in red.. In case you are wondering why there are two print script lines, it is because   copy needs to be printed and this is on another printer...

     Thank you

         
  •           Allow User Abort [ Off ]
  •      
  •           Set Error Capture [ On ]
  •      
  •           Set Variable [ $Q; Value:INVOICE DETAILS::ID_Customer_Billing_fk ]
  •      
  •           Set Field [ INVOICE DETAILS::Comments Quotation; TextSize( TextFont( (INVOICE DETAILS::Comments Quotation); "Times New Roman" ) ; 14) ]
  •      
  •           Commit Records/Requests [ Skip data entry validation; No dialog ]
  •      
  •           If [ not IsEmpty(INVOICE DETAILS::Printed Quote) ]
  •      
  •           Show Custom Dialog [ Title: "Warning"; Message: "Reprint this quote?"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
  •      
  •           If [ Get(LastMessageChoice) = 1 ]
  •      
  •           Perform Script [ “RePrint Quote” ]
  •      
  •           Exit Script [ ]
  •      
  •           Else
  •      
  •           Exit Script [ ]
  •      
  •           End If
  •      
  •           End If
  •      
  •           Loop
  •      
  •           Show Custom Dialog [ Title: "Message"; Message: "Do you want to print this quote?"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
  •      
  •           Go to Record/Request/Page [ First ]
  •      
  •           If [ Get(LastMessageChoice) = 1 ]
  •      
  •           Show Custom Dialog [ Title: "Reminder"; Message: "Have you (un)checked the boxes to include the measuring/sign order form"; Default Button: “Yes”, Commit: “Yes”; Button 2: “No/Cancel”, Commit: “No” ]
  •      
  •           If [ Get(LastMessageChoice) = 2 ]
  •      
  •           Go to Field [ INVOICE DETAILS::Text_Signed Form_deposit ]
  •      
  •           Exit Script [ ]
  •      
  •           End If
  •      
  •           Commit Records/Requests [ Skip data entry validation; No dialog ]
  •      
  •           Set Variable [ $ID; Value:INVOICE DETAILS::ID_Invoice_pk ]
  •      
  •           Freeze Window
  •      
  •           Go to Related Record [ From table: “invoicedetails_INVOICEITEM”; Using layout: “Quote Print” (INVOICEITEMS) ] [ Show only related records ]
  •      
  •           Print Setup [ Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore; No dialog ]
  •      
  •           Print [ Records being browsed; All Pages; Orientation: Landscape; Paper size: 1.41" x 3.49" ] [ Restore: Letters Printer; No dialog ]
  •      
  •           Print Setup [ Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore; No dialog ]
  •      
  •           Print [ Records being browsed; All Pages; Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore: B&W Copy printer; No dialog ]
  •      
  •           If [ Get (LastError) = 0 ]
  •      
  •           #Set Print TimeStamp
  •      
  •           Enter Browse Mode
  •      
  •           Go to Layout [ “Quote” (INVOICE DETAILS) ]
  •      
  •           Set Field [ INVOICE DETAILS::TimeStamp_Printed Quote; Get (CurrentTimeStamp) ]
  •      
  •           Set Field [ INVOICE DETAILS::Status Quote; "Posted" & " " & Get (CurrentDate) ]
  •      
  •           Set Field [ INVOICE DETAILS::Printed Quote; "Yes" ]
  •      
  •           Set Field [ invoicedetails_CUSTOMERS__billing::Follow Up Actions Box; "Quote Sent" ]
  •      
  •           Set Field [ invoicedetails_CUSTOMERS__billing::Follow_Up_Date_Due; Get(CurrentDate) + 14 ]
  •      
  •           Set Field [ invoicedetails_CUSTOMERS__billing::Information; "Quote Sent " & Get(CurrentDate) ]
  •      
  •           Set Field [ invoicedetails_CUSTOMERS__billing::Follow_Up_Date_Recent; Get(CurrentDate) ]
  •      
  •           Set Field [ invoicedetails_CUSTOMERS__billing::Status Date; Get(CurrentDate) ]
  •      
  •           Set Field [ invoicedetails_CUSTOMERS__billing::Followed Up; "No" ]
  •      
  •           Go to Layout [ “Dymo Invoice” (INVOICE DETAILS) ]
  •      
  •           Print Setup [ Orientation: Landscape; Paper size: 1.41" x 3.49" ] [ Restore; No dialog ]
  •      
  •           Print [ Current record; All Pages; Orientation: Portrait; Paper size: 8.5" x 11" ] [ Restore: DYMO LabelWriter 400 Turbo; No dialog ]
  •      
  •           Go to Layout [ “Quote” (INVOICE DETAILS) ]
  •      
  •           #Set Reminder
  •      
  •           Perform Find [ Specified Find Requests: Find Records; Criteria: INVOICE DETAILS::ID_Customer_Billing_fk: “$Q” AND INVOICE DETAILS::Type: “Quote” AND INVOICE DETAILS::Status Quote: “not posted” ] [ Restore ]
  •      
  •           If [ Get(FoundCount) = 0 ]
  •      
  •           Show Custom Dialog [ Title: "Message"; Message: "Quote Printed"; Default Button: “OK”, Commit: “Yes” ]
  •      
  •           Go to Layout [ “QuoteList” (INVOICE DETAILS) ]
  •      
  •           End If
  •      
  •           End If
  •      
  •           End If
  •      
  •           Go to Record/Request/Page [ Next; Exit after last ]
  •      
  •           End Loop
  •      
  •           If [ Get(LastMessageChoice) = 3 ]
  •      
  •           Exit Script [ ]
  •      
  •           End If
  •      
  •           #Print labels
  •      
  •           Set Variable [ $ID_Contact; Value:INVOICE DETAILS::ID_Customer_Billing_fk ]
  •      
  •           Freeze Window
  •      
  •           If [ Get(LastMessageChoice) = 2 ]
  •      
  •           Exit Script [ ]
  •      
  •           End If

Outcomes