cancel
Showing results for 
Search instead for 
Did you mean: 

Passing parameters to Crystal reports viewer

Former Member
0 Kudos
208

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.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Typically if no data you get a log on failure but you need to trp it so you can get more info. Add API logging to see exactly where the error is happening. Simplify the samples and steps...

Answers (2)

Answers (2)

Former Member
0 Kudos

My apologies for not posting in the correct forum, any help is greatly appreciated.

former_member183750
Active Contributor
0 Kudos

Something I find confusing here. You appear to be using.NET, yet there are these references to include asp pages. E.g.;

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

Umm, wondering what's up with that? Are you trying to use the RDC (craxdrt.dll) in a web app in .NET?

Ludek

Former Member
0 Kudos

Hi Ludek,

It's not a .Net app, I'm doing all of this from classic asp pages.

I used the examples I found in Business Objects\Report Application Server 11\Samples\Asp\Simple Discrete Parameters

and I built a page called expense_report_parameters.asp for the user to input the parameters, and then built a expense_report.asp page to display the report, and the code looks like this:

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" -->

<%

clientDoc.databaseController.logon "Accpac","Accpac"

clientDoc.DataDefController.ParameterFieldController.setCurrentValue "", "Fiscal Period", fiscal_period

clientDoc.DataDefController.ParameterFieldController.setCurrentValue "", "Fiscal Year", fiscal_year

clientDoc.DataDefController.ParameterFieldController.setCurrentValue "", "Department", 84

%>

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

The report runs with the correct parameters, but the user can't click on print, export, or any other item on the report without getting an error. If I remove the code pertaining to setting parameter values then the report runs just fine and the user is able to use the print, export, etc functions

0 Kudos

Hello,

Moved again to the Legacy Forums.

I'm surprised it worked at all. RAS is .NET and managed ASP code so you can NOT use those RAS samples in calssic ASP.

Go to our download Page above and look for the RDC samples, not .NET or Report Application Server code.

An throw all your code away, it will never work not is it supported.

Thank you

Don

Former Member
0 Kudos

Ok, that helps.

I've downloaded aspmps115.zip and found the examples you mentioned, I've got it working to a point but I keep getting blank reports using either SmartViewerActiveX.asp or JavaPluginViewer.asp to display the report, because I'm not seeing an error message it's hard to pinpoint the problem, but I've copied this line from the java console of a browser trying to run the report:

URL = http://cuccacctg01/mis/RDCrptserver115.asp?viewer=java&vfmt=encp&vgen=364&pversion=3&language=en-US&...

Parameters = cmd=get_pg&page=1&incomplete_page=1&incomplete_page_count=1&smart_images=1

No response from server.

Former Member
0 Kudos

Sorry, I should add that the server hosting the pages is a windows 2003 and that the browser is IE 7 (I've seen the posts that mention incompatibility with Windows 2008 and IE 😎

0 Kudos

Moved to .NET SDK forum...