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

Programatically modifying Parameter Default Values in CR10 rpts

If this isn't the correct forum for this, then I apologize. Here is the situation:

Our company uses Microsoft Dynamics SL version 7.0 (formerly Solomon), which leverages a "runtime" version of Crystal Reports 10 for some custom reports (simply named "Crystal Reports 10 for Solomon"). These reports are stored as .rpt files but are opened from within Dynamics. About 15 of these reports have a "client" parameter and I am having to manually refresh the list of default values once a month because new clients are always getting added to the system. As you can imagine, this is a pain.

My goal is to write a simple console app that can programatically refresh the default values. I would then schedule it to run nightly.

I've downloaded the CrystalReports files for VS2010 (from http://www.businessobjects.com/jump/xi/crvs2010/us2_default.asp) and I almost got it working, but I noticed a problem. If I save the file using the ReportDocument.SaveAs() method, it seems to save the rpt as a newer version of CrystalReports. When I open the report with "Crystal Reports 10 for Solomon", I get a message that says "This report was created with a version of Crystal Reports for Solomon which is later than the version you are running. Some features used in the report may not be supported."

Is there any way to save it in the native version of the original rpt? Is there an older version of Visual Studio (such as 2005?) or an older SDK that could be used to save the report as CR10?

        static void Main(string[] args)
        {

            ReportDocument rpt = new ReportDocument();
            rpt.Load(@"P:\Usr_Rpts\08CARDC - pgaule.rpt");
            //open the report
            Console.WriteLine(rpt.ParameterFields["ClientName"].DefaultValues.Count.ToString());
            rpt.ParameterFields["ClientName"].DefaultValues.Clear();
            Console.WriteLine(rpt.ParameterFields["ClientName"].DefaultValues.Count.ToString());
            rpt.SaveAs(@"P:\Usr_Rpts\08CARDC - pgaule.rpt", ReportFileFormat.VSNetFileFormat);
            rpt.Close();
         }

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 21, 2011 at 01:53 PM

    Hello,

    The short answer is that there's no way to "save down" your reports to the CR10 version without using CR10 (or CR 10 runtimes). The bundled versions of CR that ship with earlier versions of Visual Studio are built on the same CR10 code stream, but they're still not the same version. The warning message would not be eliminated by using an older version of Visual Studio.

    The only way to eliminate the warning message would be to create an application that was created with the stand alone version of CR10. I expect it would be very difficult to find a copy of CR10 Developer edition. CR10 reached End of Life for patch support in January, 2007.

    The warning message you're seeing when you open the updated report is just saying that you're opening a "newer" report with "older" runtime files. You're not really adding any new functionality to the RPT files so the warning can be ignored. If you were trying to use a dynamic cascading parameter (new functionality) this would not work correctly in your Solomon v10 application.

    Even though you can ignore the warning message there's no way to suppress it that I'm aware of.

    Sincerely,

    Dan Kelleher

    Add a comment
    10|10000 characters needed characters exceeded

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.