<HTML>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=charset=UTF-8">
<BODY>
<%
'===================================================================
' AUTHOR - SG, KA
' CREATED - March 31, 2004
' Modified by Turkbear 3/1/2006 as an example that may not work as written
'
' - Define CE Logon Variables
' - Create the Enterprise Session Manager and iStore objects
' - Create an array of Report IDs
' - Create the viewer object and view the report
'==================================================================
'Declare the CMS Logon Variables
Dim CMS
Dim Username
Dim Password
Dim Authtype
'Set CMS logon credentials - change these to match your particular CE environment
CMS = "<YOURCMS>"
Username = "<Username>"
Password = "<password>"
Authtype = "secEnterprise"
'Declare variables for Enterprise Session
Dim oEnterpriseSessionMgr
Dim ceSession
Dim iStore
'Get the values
'Load the Enterprise Session Manager
Set oEnterpriseSessionMgr = Server.CreateObject("CrystalEnterprise.SessionMgr")
'Logon to the CMS and create iStore object
Set ceSession = oEnterpriseSessionMgr.Logon(Username, Password, CMS, Authtype)
Set iStore = ceSession.Service("","InfoStore")
'Declare InfoObject Variable
Dim Report
Dim Rids() ' Build an array of Report ID#s
Dim indx
Rids(1) = 234
Rids(2) = 345
Rids(3) = 1234
'Declare the Report App Factory and Report Document Objects
Dim rptAppFactor
Dim reportDocument
'Create the Report App Factory and Report Document Objects
Set rptAppFactory = iStore.EnterpriseSession.Service("","PSReportFactory")
for indx = 0 to UBound(Rids) 'For each Report ID
Report = Rids(indx)
'Declare the viewer object variable
Dim Viewer
Set reportDocument = rptAppFactory.OpenReportSource(Report)
'Create a viewer object and view the report
Set Viewer = CreateObject("CrystalReports.CrystalReportInteractiveViewer")
With Viewer
.reportSource = reportDocument
.HasBooleanSearchButton = False
.HasCrystalLogo = False
.HasRefreshButton = True
.IsDisplayGroupTree = False
.HasPrintButton = true
.PrintMode = 0 ' disable activeX Printing - set to 1 to enable (may require plug-in if set to 1)
.IsOwnPage = true
End With
'
Set Session("viewer") = Viewer
on error resume next
Viewer.ProcessHTTPRequest Request, Response, Session
if err.number <> 0 then
response.write "Failed to view report" & "</BR>"
response.write "error number: " & err.number & "</BR>"
response.write "error description: " & err.description
end if
Server.ScriptTimeout = 36000 ' Delay the next pass through the loop ???
Next
%>
</BODY>
</HTML>