cancel
Showing results for 
Search instead for 
Did you mean: 

Getting a ReportDocument when using a RemoteReportProxy

Former Member
0 Kudos

Business Problem

I have several reports that are run locally for some users and served up from an unmanaged report server for others. We recently upgraded Visual Studio to VS2008 from VS2003.

Under VS2003, we were able to populate a set of "standard" parameters on our CrystalViewer. These parameters would be sent to all reports whether they were defined or not. If the report being called did not define one of these parameters, it would ignore them and render the report using the parameters that matched parameters that were defined on the report.

Under VS2008, we get an error telling us we have an invalid parameter when we attempt to load the report.

Users that fit the criteria for running locally (proper client software installed, good connection, etc) download the latest report from th unmanaged server. I can get a handle on the ReportDocument and remove any "standard" parameters that do not have matching parameter definitions on the report that is about to be loaded. Problem solved for these users!

Users that run the reports on the server (web services automatically created for the reports through Visual Studio using the built in Custom Tool for CR.net2008) reference the appropriate web service on the server through a RemoteReportProxy object that is set as the ReportSource on the CrystalViewer. I have not been able to find a way to reference the underlying ReportDocument to verify the parameters match properly before loading it in the CrystalViewer. This is the problem that I need help solving!

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

When using the serverfilereport web service, your access to the reportu2019s properties are limited to the Vieweru2019s api.

So what needs to be done is to bind the report web service to the viewer first, and then grab the parameterfields collection from the Crystareportviewer.Parameterfields property:

CrystaReportviewer1.Reportsource = myReport
myParameterfields = Crystalreportviewer1.ParameterFieldInfo

From there, you should be able to access the parameters and iterate through them to determine which ones match the set of u201CStandardu201D parameters and only set the necessary ones. After doing that, set your populated collection of parameterfields back to the viewer:

CrystalreportViewer1.ParameterFieldInfo = myParameterFields

Ludek

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks Ludek! I will give that a try. I wound up using a slightly more brute-force approach to get around this. The reason we were using the service to render reports in the first place was that some of our customers do not have the appropriate DB connectivity software to run the reports locally. However, this did not preclude us from being able to download the reports locally the way we do for users with the DB software installed. As a result, I download the report file that is being served and then walk the parameters list locally to ensure my parameters match the report on the server before I call the service. It is highly inelegant buit it gets the job done for now. I'll definitely try your recommended approach in a future release though.

Caleb

former_member183750
Active Contributor
0 Kudos

Hi Caleb. I'll keep my fingers crossed. And apologies for this thread being left out in the cold. I missed it and apparently everyone else did too. Well, Ok, nobody knew the answer so once I realized this was still around I went hunting and got the answer I posted. E.g.; I ain't that smart :). But I thank my lucky stars someone here is.

Happy coding,

Ludek