Combine multiple SP queries

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF ReportWriter for COM/ActiveX (v1.x)  /  Display Thread

DynamicPDF ReportWriter for COM/ActiveX (v1.x) Forum

 Feb 01 2006 5:38 AM
Hi
Is it possible to generate a report which essentially uses two seperate SP queries on the same report?

Eg
Query to show list of Customers
Query to show number of orders placed within a given date period
 Feb 01 2006 10:28 AM
Posted by a ceTe Software moderator
This would actually depend on your desired implementation.  For instance you can use separate queries in the same PDF when there are consecutive reports within that PDF.  In other words, one query produces one report followed by another query producing a different report and so on.  These reports would all be within the same PDF but none of the reports would use data from the query of the other.  Note here that if you want to add multiple reports to the same PDF you need to call the Report objects "Run" method between individual reports.

It is also possible while drawing the data from one query to use an event to do another query within that report.  This will not allow you to display all the records from the query in the event but you would be able to display things like total number of records returned.  This method could possibly work for your case depending on if you want to display just the total number of orders for a certain customer (in this case yes it would work).  If you wanted to actually display each customer's order individually then no this method will not allow you to do that.

The third option and the best way to handle getting all the orders for a particular customer is to do a database "JOIN" of the two queries you mentioned below.  This would then give you all the information you are looking for within the same record set and it can then be used within the same report.

Thanks,
ceTe Software Support Team
 Sep 08 2006 5:01 AM
Hi, I also need to run two seperate stored procedures, one after the other, to produce two seperate tables in the same pdf.

Could you show me some sample code of how to do this, in particular the use of the Run method?

Thanks.
 Sep 08 2006 10:43 AM
Posted by a ceTe Software moderator
Hello,

We do not have an example that uses multiple stored procedures. However, following is the flow of events that should take place in order to add multiple reports and use multiple stored procedures.

RecordSet produced
Report object created
Pass RecordSet to Report object
Report one
        Header
        Body
        Footer
Report Object run i.e. oReport.Run
Report object cleared i.e. oReport.Clear

New RecordSet produced
Pass New RecordSet to Report object
Report two
        Header
        Body
        Footer
DrawToASP

 
You do not need to make two calls to DrawToASP method. It needs to be called just once when drawing the final output PDF document.

Also the second report will always start from a new page and it cannot be forced to start immediately on the same page right after the first report was ended.

Thanks,
ceTe Software Support Team
 Sep 12 2006 9:31 AM
Ok, thanks for the info. Is it possible to use two queries to produce two tables on the same page in version 3?
 Sep 12 2006 10:44 AM
Posted by a ceTe Software moderator
Hello,

Yes, it is possible to use multiple queries two add two tables on the same page using v3.0 of our product without any problem. After adding the first table, you can calculate its height using the GetRequiredHeight method and then start the next table setting its Y coordinate equal to height of first table plus some padding.

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 8:53 AM.