Hi,
I am using the following code from BO to pass parameters from a web page to generate a crystal report via the RASReportFactory object. It was working fine but now it just hangs ... any ideas? The original code called for PSReportFactory but I couldn't get that to work. Thanks in advance.
<%
'===================================================================
' AUTHOR - Shawn Gagnon
' CREATED - October 6, 2003
' PURPOSE - This sample ASP application demonstrates how to view
' on demand a report with a multiple value parameter
' using the Crystal Enterprise 9 COM SDK.
' DESCRIPTION
' - Define CE Logon Variables
' - Create the Enterprise Session Manager and iStore objects
' - Query the APS for a report to view
' - Create and pass parameter for the report
' - Create the viewer object and view the report
'==================================================================
'Declare the APS Logon Variables
Dim APS
Dim Username
Dim Password
Dim Authtype
'Set APS logon credentials - change these to match your particular CE environment
APS = "<Set this to the name of your APS>"
Username = "<Your user name>"
Password = "<Your password>"
Authtype = "secEnterprise"
'Declare variables for Enterprise Session
Dim oEnterpriseSessionMgr
Dim ceSession
Dim iStore
'Load the Enterprise Session Manager
Set oEnterpriseSessionMgr = Server.CreateObject("CrystalEnterprise.SessionMgr")
'Logon to the APS and create iStore object
Set ceSession = oEnterpriseSessionMgr.Logon(Username, Password, APS, Authtype)
Set iStore = ceSession.Service("","InfoStore")
'Declare InfoObject Variable
Dim Reports
Dim Report
'Query the APS for the report you wish to view
Set Reports = iStore.Query("Select * from CI_InfoObjects Where SI_ProgID = 'CrystalEnterprise.Report' and SI_ID= 1062")
Report = Reports.Item(1).Properties("SI_ID")
'Declare the report parameter variables
Dim reportParameters
Dim Fields
Dim myParameter
Dim Value
'Get the report parameter using the plugin interface
Set reportParameters = Reports.Item(1).PluginInterface("Report").ReportParameters
'Create a new Field Object
Set Fields = CreateObject("CrystalReports.Fields")
'Create a new Parameter Object
Set myParameter = CreateObject("CrystalReports.ParameterField")
'Create a new value object
Set value = createobject("CrystalReports.ParameterFieldDiscreteValue")
'Set the Value for the parameter
value.value = "City Cyclists"
'Add the current value for the parameter
myParameter.CurrentValues.Add value
'Create value 2 for multiple value parameter
Set value2 = createobject("CrystalReports.ParameterFieldDiscreteValue")
'Set the Value for the parameter
value2.value = "Pathfinders"
'Add the current value for the parameter
myParameter.CurrentValues.Add value2
'Set a name for the parameter
myParameter.Name = reportParameters.Item(1).ParameterName
'Add the parameter value to the fields collection
Fields.Add myParameter
'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("","RASReportFactory")
Set reportDocument = rptAppFactory.OpenReportSource(CInt(Report))
'Declare the viewer object variable
Dim Viewer
'Create a viewer object and view the report
Set Viewer = CreateObject("CrystalReports.CrystalReportInteractiveViewer")
With Viewer
.reportSource = reportDocument
.ParameterFields = Fields
End With
'Error handle
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
%>
I am using the following code from BO to pass parameters from a web page to generate a crystal report via the RASReportFactory object. It was working fine but now it just hangs ... any ideas? The original code called for PSReportFactory but I couldn't get that to work. Thanks in advance.
<%
'===================================================================
' AUTHOR - Shawn Gagnon
' CREATED - October 6, 2003
' PURPOSE - This sample ASP application demonstrates how to view
' on demand a report with a multiple value parameter
' using the Crystal Enterprise 9 COM SDK.
' DESCRIPTION
' - Define CE Logon Variables
' - Create the Enterprise Session Manager and iStore objects
' - Query the APS for a report to view
' - Create and pass parameter for the report
' - Create the viewer object and view the report
'==================================================================
'Declare the APS Logon Variables
Dim APS
Dim Username
Dim Password
Dim Authtype
'Set APS logon credentials - change these to match your particular CE environment
APS = "<Set this to the name of your APS>"
Username = "<Your user name>"
Password = "<Your password>"
Authtype = "secEnterprise"
'Declare variables for Enterprise Session
Dim oEnterpriseSessionMgr
Dim ceSession
Dim iStore
'Load the Enterprise Session Manager
Set oEnterpriseSessionMgr = Server.CreateObject("CrystalEnterprise.SessionMgr")
'Logon to the APS and create iStore object
Set ceSession = oEnterpriseSessionMgr.Logon(Username, Password, APS, Authtype)
Set iStore = ceSession.Service("","InfoStore")
'Declare InfoObject Variable
Dim Reports
Dim Report
'Query the APS for the report you wish to view
Set Reports = iStore.Query("Select * from CI_InfoObjects Where SI_ProgID = 'CrystalEnterprise.Report' and SI_ID= 1062")
Report = Reports.Item(1).Properties("SI_ID")
'Declare the report parameter variables
Dim reportParameters
Dim Fields
Dim myParameter
Dim Value
'Get the report parameter using the plugin interface
Set reportParameters = Reports.Item(1).PluginInterface("Report").ReportParameters
'Create a new Field Object
Set Fields = CreateObject("CrystalReports.Fields")
'Create a new Parameter Object
Set myParameter = CreateObject("CrystalReports.ParameterField")
'Create a new value object
Set value = createobject("CrystalReports.ParameterFieldDiscreteValue")
'Set the Value for the parameter
value.value = "City Cyclists"
'Add the current value for the parameter
myParameter.CurrentValues.Add value
'Create value 2 for multiple value parameter
Set value2 = createobject("CrystalReports.ParameterFieldDiscreteValue")
'Set the Value for the parameter
value2.value = "Pathfinders"
'Add the current value for the parameter
myParameter.CurrentValues.Add value2
'Set a name for the parameter
myParameter.Name = reportParameters.Item(1).ParameterName
'Add the parameter value to the fields collection
Fields.Add myParameter
'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("","RASReportFactory")
Set reportDocument = rptAppFactory.OpenReportSource(CInt(Report))
'Declare the viewer object variable
Dim Viewer
'Create a viewer object and view the report
Set Viewer = CreateObject("CrystalReports.CrystalReportInteractiveViewer")
With Viewer
.reportSource = reportDocument
.ParameterFields = Fields
End With
'Error handle
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
%>