Search This Blog

Thursday, June 13, 2013

Multiple Reports in SQR at ease

You can print multiple reports with ease using the simple structure below. 

DECLARE-REPORT can declare n number of reports (max 99) and use it for the respective printing. There is catch at this point. What if the reports are dynamic and you cannot forcast the number of reports that gets generated.

Then the below code can be handy.

You have the while loop and NEW-REPORT part inside it. Make the file name dynamic based on the variables in your code. And that's it. 

No headaches of declaring multiple reports in the begin-setup and you can get n number of reports (max infinity), without the limitation of 99.

Hope, this will be a handy code for you.

2 comments:

  1. AnonymousJune 18, 2013

    Hi,
    Could you please let us know how can I name file name on run time as here you set testing.pdf. for all 10 run only one file will be generated but I need testing1.pdf ,testing2...etc
    then how should I need to code

    ReplyDelete
  2. You can do this by modifying the file name string dynamically. Suppose you have the EMPLID as 1,2,3,5 etc. Then do this to create reports with multiple names -
    NEW-REPORT 'C:\temp\testing'||$EMPLID||'.pdf'

    Whatever you pass dynamically should be in a string format, otherwise you will get an error.

    Check it out!

    ReplyDelete