RPT Software - Report Server Examples
The best way to see examples is to download the evaluation
and look at the examples provided, however here are a few
code samples:
--------------------------------
This example is a simple call to a create a report with no
criteria:
QueuePath = "F:\InetPub\Scripts\ReportQueue.mdb"
DatabasePath = "F:\InetPub\Scripts\Example.mdb"
ReportName = "rptExample"
QueryName = ""
QueryText = ""
ReportFormat = "PDF"
set ReportQ = Server.CreateObject("ReportQ.CReportQ")
ReportFile = ReportQ.MakeReport(QueuePath, DatabasePath,
ReportName, QueryName, QueryText, ReportFormat)
'HTML to either redirect the report file or display a hyperlink
to the file
set ReportQ = Nothing
--------------------------------
This example shows how to include a WHERE clause to limit
the report to whatever criteria you gather from the user (Only
the QueryText parameter changes):
QueuePath = "F:\InetPub\Scripts\ReportQueue.mdb"
DatabasePath = "F:\InetPub\Scripts\Example.mdb"
ReportName = "rptExample"
QueryName = ""
QueryText = "WHERE
Salary > 50000"
ReportFormat = "PDF"
set ReportQ = Server.CreateObject("ReportQ.CReportQ")
ReportFile = ReportQ.MakeReport(QueuePath, DatabasePath,
ReportName, QueryName, QueryText, ReportFormat)
'HTML to either redirect the report file or display a hyperlink
to the file
set ReportQ = Nothing
--------------------------------
This example shows how to base your report on a query created
"on the fly". Sometimes you need more than
a simple WHERE clause, maybe you need to join different tables
etc.... (Only the QueryName and QueryText parameters changes):
QueuePath = "F:\InetPub\Scripts\ReportQueue.mdb"
DatabasePath = "F:\InetPub\Scripts\Example.mdb"
ReportName = "rptExample"
QueryName = "qryExample"
QueryText = "Select tblExample.* WHERE
Salary > 35000"
ReportFormat = "PDF"
set ReportQ = Server.CreateObject("ReportQ.CReportQ")
ReportFile = ReportQ.MakeReport(QueuePath, DatabasePath,
ReportName, QueryName, QueryText, ReportFormat)
'HTML to either redirect the report file or display a hyperlink
to the file
set ReportQ = Nothing
--------------------------------
This example shows one way of approaching using Access Reporting
off of SQL Server data. You start by setting up the
underlying report query as a Pass Thru query with a saved
username and password to your SQL Server database. You
next setup a stored procedure in SQL Server. You then
build the text of the query at runtime to call the stored
procedure with the correct parameters:
QueuePath = "F:\InetPub\Scripts\ReportQueue.mdb"
DatabasePath = "F:\InetPub\Scripts\Example.mdb"
ReportName = "rptExample"
QueryName = "qryExample"
QueryText = "Exec proc_mystoredprcedure state = 'PA',
salary = 35000"
ReportFormat = "PDF"
set ReportQ = Server.CreateObject("ReportQ.CReportQ")
ReportFile = ReportQ.MakeReport(QueuePath, DatabasePath,
ReportName, QueryName, QueryText, ReportFormat)
'HTML to either redirect the report file or display a hyperlink
to the file
set ReportQ = Nothing
|