Skip to Content
0
Former Member
Apr 12, 2010 at 09:31 PM

Passing parameters to Crystal reports viewer

120 Views

Hello,

I've been struggling with this for longer than I care to admit, but I'm not sure how to resolve.

We just upgraded from Crystal reports 8.5 to 11. We previously had some ASP pages that allowed users to input some parameter values and then view the report via internet explorer, where they could then export. print, etc.

I followed the examples under Business Objects\Report Application Server 11\Samples\Asp\Simple Discrete Parameters that were part of the install package, and came up with code that did the following:

Dim fiscal_period, fiscal_year, reportname

fiscal_period = Request.Form("fiscal_period")

fiscal_year = Request.Form("fiscal_year")

reportname = "./Reports/Departmental_Expense_Report.rpt"

%>

<!-- #include file="AlwaysRequiredSteps.asp" -->

<%

Dim paramController

Set paramController = clientDoc.DataDefController.ParameterFieldController

paramController.setCurrentValue "", "Fiscal Period", fiscal_period

paramController.setCurrentValue "", "Fiscal Year", fiscal_year

paramController.setCurrentValue "", "Department", 84

clientDoc.databaseController.logon "user","pw"

%>

<!-- #include file="crystalreportsviewer.asp" -->

the report runs and passes the parameter values, but as soon as I try to use the toolbar to print, export, search, go to the next page, I get an error in Internet explorer, page cannot be displayed.

If I remove the following lines:

Dim paramController

Set paramController = clientDoc.DataDefController.ParameterFieldController

paramController.setCurrentValue "", "Fiscal Period", fiscal_period

paramController.setCurrentValue "", "Fiscal Year", fiscal_year

paramController.setCurrentValue "", "Department", 84

Then the crystal reports viewer prompts the user to enter the parmeter values before running the report. If i do it this way everything runs fine.

Unfortunately for me, I can't let users have access the the crystal reports viewer prompt because there are some parameter values that I want to hide from certain users.