Tag Archive: report

hand code print previewer

Some people have asked me to forward to them an example. I am putting the example here for all to see. I hope it can sassist in overcoming some of the reporting hassles! This is a hand coded multiple detail report, using ABC’s print previewer. Note the Module level include – do not put it at procedural level. This reports first on Customer file, then on OtherCustomer file.

   MEMBER('roadshow.clw')                             ! This is a MEMBER
module

                     MAP
                       INCLUDE('ROADS010.INC'),ONCE        !Local module prodecure declarations
                     END


Include('ABREPORT.INC')        !********MODULE LEVEL INCLUDE**********************
HandCodedReport      PROCEDURE                        ! Declare Procedure
LocalPreviewQueue   PreviewQueue
Previewer           PrintPreviewClass
Report
REPORT,AT(1000,1271,6000,7729),PRE(RPT),FONT('Arial',10,,),PREVIEW(LocalPreviewQueue),THOUS
       HEADER,AT(1000,1000,6000,281)
         STRING('Customer List'),AT(52,52,5906,208),USE(?String1),TRN,CENTER
       END
Detail DETAIL,AT(,,,271)
         STRING(@s100),AT(31,21),USE(CUS:CustomerName),TRN
       END
detail2 DETAIL,AT(,,,333)
         STRING(@s40),AT(73,83,2448,208),USE(Cus2:CustomerName),TRN
       END
     END
  CODE
Relate:Customers.Open
Open(Report)
Previewer.Init(LocalPreviewQueue)
Previewer.Maximize = True
Previewer.ZoomIndex = PageWidth
Previewer.AllowUserZoom = True
Previewer.UserPercentile = 120
Previewer.SetZoomPercentile(120)
Report{Prop:Text} = 'Currently Printing Hand Coded Report'
Set(Customers)
Loop
   Next(Customers)
   If Error() then
     Break
   End
   Print(RPT:Detail)                            !don't forget the reports' prefix when using the print verb
End

Set(OtherCustomers)
Loop
   Next(OtherCustomers)
   If Error() then
     Break
   End
   Print(RPT:Detail2)
End

EndPage(Report)    !do not forget this
Report{Prop:FlushPreview} = Previewer.Display()
Close(Report)
Relate:Customers.Close