Skip to Content
author's profile photo Former Member
Former Member

Getting a ReportDocument when using a RemoteReportProxy

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!

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jan 29, 2010 at 08:35 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2010 at 09:18 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.