2 Replies Latest reply on Mar 4, 2014 10:00 AM by willrollo

    Printing a batch using different layouts

      Title

      Printing a batch using different layouts

      Post

           I am trying to create a script that will print out a batch of letters depending on the data on a particular field for each customer. The print layout is determined by this field. 

           I cant seem to get it to work. the script selects the correct customers, but the layouts are not correct. I think I know why, I jsut cant work out how to fix it...Below is the script..:

           Thank you

            

             
      •           Perform Find [ Specified Find Requests: Find Records; Criteria: CUSTOMERS::Follow Up required Check Box: “Y” ] [ Restore ]
      •      
      •           #Set Reminder
      •      
      •            
      •      
      •           If [ CUSTOMERS::Followed Up ="Yes" ]
      •      
      •           Show Custom Dialog [ Title: "Error"; Message: "You have already sent a follow up letter to "& CUSTOMERS::To Retail & ". To reset this, please select the follow up letter you would like to print from the dropdown menu under the Status header."; Default Button: “OK”, Commit: “Yes” ]
      •      
      •           Show All Records
      •      
      •           Exit Script [ ]
      •      
      •           End If
      •      
      •            
      •      
      •           If [ CUSTOMERS::Follow Up Actions Box = "Tel Follow Up" ]
      •      
      •           Go to Related Record [ From table: “CUSTOMERS”; Using layout: “Tel Follow Up” (CUSTOMERS) ] [ Show only related records; Match found set ]
      •      
      •           Print Setup [ Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore; No dialog ]
      •      
      •           Enter Preview Mode
      •      
      •           Print [ Records being browsed; All Pages; Orientation: Portrait; Paper size: 8.5" x 11" ] [ Restore: Kitchen Printer; No dialog ]
      •      
      •           Enter Browse Mode
      •      
      •           Else If [ CUSTOMERS::Follow Up Actions Box = "No new enquiry letter" ]
      •      
      •           Go to Related Record [ From table: “CUSTOMERS”; Using layout: “Brochure Followed Up” (CUSTOMERS) ] [ Show only related records; Match found set ]
      •      
      •            
      •      
      •           Print Setup [ Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore; No dialog ]
      •      
      •           Enter Preview Mode
      •      
      •           Print [ Records being browsed; All Pages; Orientation: Portrait; Paper size: 8.5" x 11" ] [ Restore: Kitchen Printer; No dialog ]
      •      
      •           Enter Browse Mode
      •      
      •           Print Setup [ Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore; No dialog ]
      •      
      •           Enter Preview Mode
      •      
      •           Print [ Records being browsed; All Pages; Orientation: Portrait; Paper size: 8.5" x 11" ] [ Restore: Kitchen Printer; No dialog ]
      •      
      •           Enter Browse Mode
      •      
      •            
      •      
      •           Else
      •      
      •           Show Custom Dialog [ Title: "Error"; Message: CUSTOMERS::To Retail & " does not need a follow up. To reset this, please select the follow up letter you would like to print from the dropdown menu under the Status header."; Default Button: “OK”, Commit: “Yes” ]
      •      
      •           Exit Script [ ]
      •      
      •           End If
      •      
      •            
      •      
      •           Print Setup [ Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore; No dialog ]
      •      
      •           Enter Preview Mode
      •      
      •           Print [ Records being browsed; All Pages; Orientation: Landscape; Paper size: 8.26" x 11.69" ] [ Restore: Kitchen Printer; No dialog ]
      •      
      •           Enter Browse Mode
      •      
      •            
      •      
      •           If [ Get(LastError)=0 ]
      •      
      •           Replace Field Contents [ CUSTOMERS::Follow_Up_Date_Old; Replace with calculation: CUSTOMERS::Follow_Up_Date_Recent ] [ No dialog ]
      •      
      •           Replace Field Contents [ CUSTOMERS::Follow_Up_Date_Recent; Replace with calculation: Get(CurrentDate) ] [ No dialog ]
      •      
      •           Replace Field Contents [ CUSTOMERS::Follow Up Actions Box; Replace with calculation: "Followed Up" ] [ No dialog ]
      •      
      •           Replace Field Contents [ CUSTOMERS::Follow Up required Check Box; Replace with calculation: "" ] [ No dialog ]
      •      
      •           Replace Field Contents [ CUSTOMERS::Followed Up; Replace with calculation: "yes" ] [ No dialog ]
      •      
      •           Else
      •      
      •           Show Custom Dialog [ Title: "Error"; Message: "There was an error printing these follow ups- please try again"; Default Button: “OK”, Commit: “Yes” ]
      •      
      •           End If
      •      
      •           Show All Records
      •      
      •           Go to Layout [ original layout ]

        • 1. Re: Printing a batch using different layouts
          philmodjunk

               What layout are you on when this script starts?

               It appears that you are finding a group of records, but your script only uses the data in one of those found records to decide what layout to use for printing a follow up letter.

               Assuming that your group of found records each specify different options for a follow up letter, you need to loop through them and process them one at a time, selecting the appropriate layout for each. And then there will probably be no need for a go to related records step if you start on the customers layout when you first perform this script.

               And there is no need to enter preview mode to preview the letter--which slows down your script, unless you are going to pause the script so that the user can see the previewed letter before it is printed.

          • 2. Re: Printing a batch using different layouts

                 Brilliant - thank you. I am not 100% confident with loops, but shall give it a go! Thank you again