Missing parameter values message when exporting report

Post Author: Gr_Pr
CA Forum: .NET
Using .NET 2005, CR XI R2, and the Crystal SDK for .NET 2005 to generate reports. Basically CR is my application's reporting tool. So, we create a report in CR XI R2, then distribute that report to our users loading it into the .NET application using the Report Document class.
We have a small problem.
Our user's have the ability to use pre-defined 'prompts' that will pass parameters to the reports. Let's say that the prompt will pass in (5) pre-defined parameter values, but the customer wants to run their own 'custom' report using our prompt, but their 'custom' report contains (6) parameters.
If I let the Report Viewer load the report, the user will be prompted for the missing parameter value that was not supplied by the 'prompt'.
If I run the report without loading it into the Viewer and try to export the report directly to PDF I receive an error message from CR stating I have 'Missing Parameter Values' then the report errors out.
Has anyone come across this? Is there something I missed?
I am not real sure as to why you would be prompted by the Viewer and not by the Export Class. This worked fine when using the RDC component, I was prompted for the missing parameter value by both options.
Any help would be greatly appreciated.

Hi,
The report has it's own ADO Datasource set in crystal reports, so I just pass the log on information to the report object before doing anything else.
this.DataSourceConnections[0].SetConnection("ServerName", "Database", "sa", "Password");
I then do a refresh before applying the parameter values (I do this because the user can preview the report more than one time by using a preview button on the parameter form without re-loading the report object)
this.Refresh();
Then I set all parameter values followed by setting the recordselection formula.

Similar Messages

  • "Missing parameter values" error on Export

    Hi,
    I am getting "Missing Parameter Values" error if all required parameter values are not passed in the report through application. Same error is not coming when all the parameters are passed.
    And parameter window also not displaying if all parameters are not passed to the report for export option. (Parameter window displaying on preview option if all the parameters are not supplied).
    I have tried both Report Viewer's ExportReport function & ReportDocument's Export function. But both are results same.
    Software details:
    Crystal Report created in Version: 10.0.0.533
    .Net 2005
    10.2 Crystal component. Crystal Runtime Version - v2.0.50727 and DLL Version - 10.2
    Please help me to resolve this issue.
    Thanks,
    Venkateswaran.P

    Given example is not working as expected.
    1) Calling of  ExportReport() function invokes the file Save As window to save the exported file eventhough exported path & file name supplied in the program.
    2) After accepting the output file name, "Missing parameter values" error coming instead of displaying Crystal's Parameter window.
    Below is the piece of code to export the output. I am calling Export() function if all the parameters are supplied by the application otherwise i am calling Viewer's ExportReport() fuction. Please have a look and let me know if any code change is required.
                   ReportDocument crRepDocument;
                   String m_strExportPath;
                    Boolean bUseRepViewExport = false;
                    if( crRepDocument.ParameterFields.Count > 0 )
                        if (m_Parameters.Count < crRepDocument.ParameterFields.Count)
                                bUseRepViewExport = true ;
                    ExportOptions crExportOptions;
                    DiskFileDestinationOptions crDiskFileDestinationOptions;
                    crDiskFileDestinationOptions = new DiskFileDestinationOptions();
                    crExportOptions = crRepDocument.ExportOptions;
                    if (base.m_ExportFormat == eExportFormat.RTF)
                       crDiskFileDestinationOptions.DiskFileName = base.m_strExportPath + ".rtf";
                        crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                        crExportOptions.ExportFormatType = ExportFormatType.RichText;
                        crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
                    else if (base.m_ExportFormat == eExportFormat.PDF)
                        crDiskFileDestinationOptions.DiskFileName = base.m_strExportPath + ".pdf";
                        crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
                        crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                        crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
                    else if (base.m_ExportFormat == eExportFormat.DOC)
                     if (bUseRepViewExport)  //If all the parameter are not supplied. I calling Viewer
                        FormReportViewer oFormReportViewer = new FormReportViewer();
                        oFormReportViewer.CrystalReportViewer.ReportSource = crRepDocument;
                        oFormReportViewer.CrystalReportViewer.ExportReport();
                        return true;                 
                    else
                        crRepDocument.Export();  //
                        return true;

  • "Missing parameter values" error on Export - rehash

    VS2008, CR2008, no SP.
    I am getting this when trying to use the export button on the CrystalReportViewer tool bar.  I am pretty sure I need to refresh the report when the export button is clicked, but I cannot find a CrystalReportViewer event for this.  I created my own Export button and refresh the report when it is clicked and it works fine - no errors.  So now I want to get rid of the Export button from the button bar, but it seems that this is not possible?
    I guess my question is... is there an event I can trap associated with when the export button on the original CrystalReportViewer toolbar is pressed OR is there a way to get rid of the Export button on the toolbar?
    Thanks,
    Dave

    Yikes - I can't believe I missed that!  OK the button is gone and all is well.
    This has been an interesting project.  I usually set up my reports with BOTH the CrystalReportSource and the CrystalReportViewer and that combination seems to always work great.  Its really easy to pass parameters and selection formulas with this combination.  However, I have one report that I need to pass both parameters AND a selection formula to the main report AND a subreport so I have to get rid of the CrystalReportSource and instead use the CrystalReports.Engine.  This gets a bit more tricky as I have found out.
    Anyways all is well.  Thanks for your help - you showed me something that was right in front of my face.
    Dave

  • ReportDocument.ExportToStream raises "Missing Parameter Values" exception

    Hi,
    I have a web app built using VS 2008 which runs many reports developed in CR 2008. Most of these reports take parameters and many have embedded subreports. Many of the reports can either be viewed directly or e-mailed. For the latter, I use ReportDocument.ExportToStream(ExportFormatType.PortableDocFormat) to export a PDF file which then gets attached to the e-mail.
    One set of reports works fine when viewed directly, but raises a "Missing Parameter Values" exception when I try to generate the PDF.  All the other reports, seemingly similar in most respects, including the number and type of parameters, work fine when calling ExportToStream.
    Here is the really strange part: the exception is spurious. I wrapped the whole thing in a try/catch block to better examine the exception, hoping to find which parameter value is actually missing.  I could not identify the missing parameter value, but once I handled the exception, the report runs fine and converts to PDF.
    Any hints as to what could be causing this problem?  It seems like a really bad hack to solve the problem using a try/catch in this way.
    Thanks.
    Dan

    Thanks for the quick response. Your code was very instructive, but did not help yet.  Here is what I have:
    (This response is too long for a single post, so I will split it and finish in the next post.)
    ReportDocument rptDoc = new ReportDocument();
    rptDoc.Load(strReportSourceFolder + strReportName + ".rpt");
    rptDoc.SetParameterValue("ClientID", lngKeyFieldID);
    rptDoc.SetParameterValue("Role", "Client");
    This is followed by an amazing chunk of code, provided to me by a guy at SAP Tech Support, who said it was necessary to pass database credentials programatically.  It iterates the tables in the ReportDocument and individually sets the LogonInfo. (I say "amazing" because it astounds me you have to jump through such hoops for something that should be routine and easy.)  The commented lines are just to help in debugging.
    ConnectionInfo conn = new ConnectionInfo();
    conn.ServerName = "myServer";
    conn.DatabaseName = "myDB";
    conn.UserID = "myUserID";
    conn.Password = "myPassword";
    Tables tables = rptDoc.Database.Tables;
    foreach (Table table in tables)
      //string str= table.TestConnectivity().ToString());
      TableLogOnInfo tableLogonInfo = table.LogOnInfo;
      tableLogonInfo.ConnectionInfo = conn;
      table.ApplyLogOnInfo(tableLogonInfo);
      //table.Location = table.Location;                        
    This is followed by the viewer stuff:
    CrystalReportViewer1.DisplayGroupTree = false;
    CrystalReportViewer1.DisplayToolbar = true;
    CrystalReportViewer1.HasToggleGroupTreeButton = false;
    CrystalReportViewer1.HasToggleParameterPanelButton = false;
    CrystalReportViewer1.Page.Title = strReportName;
    CrystalReportViewer1.ReportSource = rptDoc;
    Up to here, it works fine, displaying the report.  If the report is also to be e-mailed, the following is executed:
    if (bEmail)
      //  export to PDF, then mail that
      SmtpClient client = new SmtpClient();
      MailAddress from = new MailAddress(ConfigurationManager.AppSettings["ReportMailFrom"].ToString());
      MailMessage message = new MailMessage();
      message.From = from;
      message.SubjectEncoding = System.Text.Encoding.UTF8;
      message.Subject = "E-mail BackOffice report: " + strReportName;
      try
        foreach(ParameterField field in rptDoc.ParameterFields)
          Logger.LogEvent("test", "", field.ToString(), "Trace", null, true, true);
          Logger.LogEvent("test", "", "Name: " + field.Name, "Trace", null, false, false);
          Logger.LogEvent("test", "", "PromptText: " + field.PromptText, "Trace", null, false, false);
          Logger.LogEvent("test", "", "IsOptionalPrompt: " + field.IsOptionalPrompt, "Trace", null, false, false);
        MemoryStream memStream = (MemoryStream)rptDoc.ExportToStream(ExportFormatType.PortableDocFormat);
        Attachment data = new Attachment(memStream, MediaTypeNames.Application.Pdf);
        ContentDisposition disposition = data.ContentDisposition;
        disposition.CreationDate = DateTime.Now;
        disposition.ModificationDate = DateTime.Now;
        disposition.FileName = strReportName + ".pdf";
        disposition.DispositionType = DispositionTypeNames.Attachment;
        message.Attachments.Add(data);
      catch (Exception ex)
        Logger.LogEvent("error", "Page_Load", strReportName + " Exception: " + ex.Message, "Trace", null, true, true);
      //  ...  do the rest of the stuff to create & send the e-mail
    (The rest of this message will be in the following post.  Sorry it is so long.)

  • Missing Parameter values - Error

    Post Author: Shayari
    CA Forum: .NET
    Hello,
    There is a main report,from which we pass the parameters to the subreport.The subreports parameters are the stored procedure's input parameters which are created when the SP is included as the datasource.When we integrate the master .rpt file with the C# application it throws a error saying "Missing parameter values" at the exporting line in the code. .We also get an error when we try to 'Verify database' for the subreports in the CRXI UI. The errror states "Prompting failed with the following error message Error source: Error code 0*8000FFF". This error occurs when in "Change the Subreport links" we update the "Subreport parameter fields to use" to match with the input parameters of the subreport's SP.
    We are using Crystal reports XI with Visual Studio 2005.
    Any help is much appreciated.Thank you.
    Regards,
    Shayari

    2 Things:
    1) CRXI is not compatible with VS2005. You need to upgrade to CRXIR2.
    2) You need to pass the parameters to the report before exporting the report, as Crystal need to get the report data and then exports it. It will not prompt for parameters as we are not viewing it.
    But before all this you need to make sure that you can view the report in Designer properly. Because once the report works fine in designer we can concentrate on the sdks and its working.
    Hope it helps !

  • Error: Missing Parameter Values on

    I've started experiencing the "Missing Parameter Values" error on a report containing a subreport. All of my other reports can export just fine, but just not the one with the subreport. The report (and the subreport) both use a stored procedure to retrieve their data, with 4 parameters. The first three parameters are linked directly from the report to the subreport. The 4th parameter is optional, and is linked to the subreport with a Formula Field.
    When I delete the subreport, the report exports just fine, so the issue is definitely with the subreport ?configuration?
    I'm using Visual Studio 2005, with Crystal Reports for VS 2005. I've been searching the forums, and I downloaded and installed a package: crnet20win32x86_en_chf.zip, but it didn't solve my problem. Just to be sure, I restarted and installed it with nothing running, in case that could be a factor.
    Is there anything I can do to work through this? Any other fix I'm missing?
    Thanks
    Alex

    Thanks for the tip. I did that just now, and I found the [Hot Fix|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313339333533393334%7D.do]
    That particular Hot Fix describes my situation exactly, in that a report Stored Procedure parameter is "supposed" to be passed on to the Subreport. However, the Hot Fix describes prompting, which isn't occurring in my case, since I'm exporting the report entirely in code. My situation is just the error, Missing Parameter Values.
    In any case, I've already run that entire Hot Fix package (twice), and I've found that I have 2 of the crpe32.dlls. Neither one is the version specified in the Hot Fix, (Version 10.2.0.1256). The second dll listed below seems to be of a version prior to the Hot Fix, I don't know if it could be the reason why it still doesn't work after applying the Hot Fix.
    C:Program FilesCommon FilesBusiness Objects2.7Bin (Date 1/11/2007, version: 10.2.0.1624) and
    C:Program FilesCommon FilesCrystal Decisions2.5Bin (Date 10/5/2005, version: 10.0.5.1177).
    I've checked all the versions of references in my projects, and they all reference the 2.7 dlls, but I'd like to know if there is a way to replace the 2.5 version, just in case.
    As far as the other search results, they hinted at things I've already tried. What else can I try?
    Thanks,
    Alex

  • Missing parameter values when trying to export to pdf in C#

    HI all,</BR>
    </BR>
    I'm having a problem passing a parameter from my c#.NET code through Crystal Reports 2008...</BR>
    </BR>
    Crystal Reports Developer version 12.1.0.892</BR>
    using a WinXP machine</BR>
    The parameter I've setted up in Crystal Reports Design is one to dynamically change the query that will run on the report:</BR>
    "SELECT * FROM  REPORTS.{?Protocolname}_FC_QUERY"</BR>
    </BR>
    </BR>
    The code I use calling one of the reports I must provide:</BR>
    </BR>
    using System;</BR>
    using System.Collections.Generic;</BR>
    using CrystalDecisions.CrystalReports.Engine;</BR>
    using CrystalDecisions.Shared;</BR>
    using System.Data;</BR>
    using System.Data.OracleClient;</BR>
    using System.Collections;</BR>
    namespace CrystalReportsRapportjes</BR>
    {</BR>
    class MainClass</BR>
    {</BR>
    public static void Main(string[] args)</BR>
    {</BR>
    Console.WriteLine("Start of program!");</BR>
    string connString = "server=CT_PRD;user id=report;password=report";</BR>
    OracleConnection conn = new OracleConnection(connString);</BR>
    try</BR>
    {</BR>
    conn.Open();</BR>
    Console.WriteLine("Connection opened.");</BR>
    </BR>
    Console.WriteLine("Connection Properties:");</BR>
    Console.WriteLine("\tConnection String: {0}", conn.ConnectionString);</BR>
    Console.WriteLine("\tServerVersion: {0}", conn.ServerVersion);</BR>
    Console.WriteLine("\tState: {0}", conn.State);</BR>
    QL_ExportReport("C:\\Data\\converted2crystal\\PLANNING_REPORT_params.rpt");</BR>
    </BR>
    } catch (OracleException e) {</BR>
    Console.WriteLine("Error: " + e);</BR>
    } finally {</BR>
    conn.Close();</BR>
    Console.WriteLine("Connection closed.");</BR>
    }</BR>
    Console.WriteLine("End of program!");</BR>
    Console.ReadKey();</BR>
    }</BR>
    private static void QL_ExportReport(string reportName)</BR>
    {</BR>
    ReportDocument CR_reportDocument = new ReportDocument();</BR>
    DataSet ds = new DataSet();</BR>
    CR_reportDocument.Load(reportName);</BR>
    CR_reportDocument.SetDatabaseLogon("Reports", "Reports");</BR>
    for(int i=0;i<CR_reportDocument.DataDefinition.ParameterFields.Count; i++)</BR>
    {</BR>
    Console.WriteLine("Reading parameters");</BR>
    Console.WriteLine(CR_reportDocument.DataDefinition.ParameterFields<i>.ParameterFieldName);</BR>
    if(CR_reportDocument.DataDefinition.ParameterFields<i>.ParameterFieldName==
    "Protocolname")</BR>
    Console.WriteLine("Correct parameter found, now assigning value");</BR>
    ParameterValues ThisPV = new ParameterValues();</BR>
    ThisPV.AddValue("TMC999C999");</BR>
    CR_reportDocument.DataDefinition.ParameterFields<i>.CurrentValues.Clear();</BR>
    CR_reportDocument.DataDefinition.ParameterFields<i>.DefaultValues.Clear();</BR>
    </BR>
    CR_reportDocument.DataDefinition.ParameterFields<i>.ApplyCurrentValues(ThisPV) ;</BR>
    //CR_reportDocument.SetParameterValue("Protocolname","TMC999C999");</BR>
    //CR_reportDocument.DataDefinition.ParameterFields<i>.CurrentValues.AddValue(ThisPV);</BR>
    }</BR>
    CR_reportDocument.Refresh();</BR>
    CR_reportDocument.ExportToDisk</BR>(ExportFormatType.PortableDocFormat,"C:\\Data\\converted2crystal\\EDC_PLANNING_RPT_params.pdf");</BR>
    CR_reportDocument.Close();</BR>
    }</BR>
    }</BR>
    }</BR>
    </BR>
    The exceptions he throws using this code is = CrystalDecisions.CrystalReports.Engine.ParameterFieldCurrentValueException: </BR>Missing parameter values. ---> System.Runtime.InteropServices.COMException: Missing parameter values.</BR>
    at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException</BR>
    at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream</BR>
    at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream</BR>
    at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export</BR>
    at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk</BR>
    at CrystalReportsRapportjes.MainClass.QL_ExportReport in </BR>c:\Data\sharpdevelopfolder\CrystalReportsRapportjes\CrystalReportsRapportjes\Program.cs:line 72</BR>
    at CrystalReportsRapportjes.MainClass.Main in </BR>c:\Data\sharpdevelopfolder\CrystalReportsRapportjes\CrystalReportsRapportjes\Program.cs:line 33</BR>
    </BR>
    When I use the code</BR>
    CR_reportDocument.DataDefinition.ParameterFields<i>.CurrentValues.AddValue(ThisPV);</BR>
    instead of</BR>
    CR_reportDocument.DataDefinition.ParameterFields<i>.ApplyCurrentValues(ThisPV) ;</BR>
    </BR>
    the error I get there is:</BR>
    System.ArgumentException: Value does not fall within the expected range.</BR>
    at CrystalDecisions.Shared.SharedUtils.ConvertToDecimal</BR>
    at CrystalDecisions.Shared.ParameterDiscreteValue.set_Value</BR>
    at CrystalDecisions.Shared.ParameterValues.AddValue</BR>
    at CrystalReportsRapportjes.MainClass.QL_ExportReport in </BR>c:\Data\sharpdevelopfolder\CrystalReportsRapportjes\CrystalReportsRapportjes\Program.cs:line 69</BR>
    at CrystalReportsRapportjes.MainClass.Main in </BR>c:\Data\sharpdevelopfolder\CrystalReportsRapportjes\CrystalReportsRapportjes\Program.cs:line 33
    </BR>
    </BR>
    </BR>
    Can someone please tell me what's the right way passing a parameter to a report?</BR>
    </BR>
    Thanks in advance.</BR>

    You should use the
    ReportDocument.SetParameterValue("ParameterName", "ParamValue");
    >
    Els Cochez wrote:
    > When I use the code</BR>
    > CR_reportDocument.DataDefinition.ParameterFields<i>.CurrentValues.AddValue(ThisPV);</BR>
    > instead of</BR>
    > CR_reportDocument.DataDefinition.ParameterFields<i>.ApplyCurrentValues(ThisPV) ;</BR>
    > </BR>
    > the error I get there is:</BR>
    > System.ArgumentException: Value does not fall within the expected range.</BR>
    > at CrystalDecisions.Shared.SharedUtils.ConvertToDecimal</BR>
    > at CrystalDecisions.Shared.ParameterDiscreteValue.set_Value</BR>
    > at CrystalDecisions.Shared.ParameterValues.AddValue</BR>
    > at CrystalReportsRapportjes.MainClass.QL_ExportReport in </BR>c:\Data\sharpdevelopfolder\CrystalReportsRapportjes\CrystalReportsRapportjes\Program.cs:line 69</BR>
    > at CrystalReportsRapportjes.MainClass.Main in </BR>c:\Data\sharpdevelopfolder\CrystalReportsRapportjes\CrystalReportsRapportjes\Program.cs:line 33</BR>
    > </BR>
    > </BR>
    > Can someone please tell me what's the right way passing a parameter to a report?</BR>
    > </BR>
    Try parsing the parameter value to a decimal value before setting it as parameter value.
    Hope this will help

  • ReportDocument.Export() raises "Missing Parameter Values" exception

    Hi
    Recently I encountered a question about SAP Crystal Report that I have a rpt file with several sub reports and I am required to make the data source to be XML with http/https URLs. I created different .NET pages which returns XML stream as data source for both main report and sub reports in my rpt file, and also created a sub report links which pass dynamic parameters from main report to the sub reports, everything worked fine when I entered the necessary parameters only for the main report in the design tool, both the main report and sub reports displayed perfectly.
    But it did not work in my .NET application which export the reports to PDFs, I referenced “CrystalDecisions.CrystalReports.Engine” and some other necessary DLLs into my project, and then I created an instance of ReportDocument, loaded the rpt file, set parameters which used in the main report, set connection info, and at last when I export the report it throw out an exception with “Missing Parameter Values” error message, even though I removed the sub report links which pass parameters from main report, the exception still occurred, but when I removed all the sub reports, and only export the main report it worked!!
    Here is a result of my attempts:
    Main Report
    Sub Report
    Result
    1
    With XML data source
    No report
    Works fine with dynamic parameters set to the http/https url which returns an xml results
    2
    With XML data source
    Pass a static value and print it on the report
    Works fine.
    3
    With XML data source
    Create a SQL command WITHOUT any parameters passed from main report
    Works fine
    4
    With XML data source
    Create a SQL command WITH a dynamic parameter passed from main report
    Works fine
    5
    With XML data source
    Create a xml data source WITHOUT any parameters passed from main report
    Failed with "Missing Parameter Values"
    6
    With XML data source
    Create a xml data source WITH a dynamic parameter passed from main report
    Failed with "Missing Parameter Values"
    I am confused about this issue for a few days, is there any ideas or helps? many thanks!

    OK:
    We upgraded to CR 13.0.2000.0 and Visual Studio 2012 and .Net Framework 4.5.
    Problem still happens.
    When we display the report in the designer, the url has parameters.  Here are the IIS log entries:
    2014-05-01 18:24:56 192.168.251.10 GET /quotit/apps/leadspro/CrystalServiceGateway_test.aspx @IFPPSID=1899582751211388&@styleColorScheme=10511658/13343077/10511658/13343077/16777215/15720656/16777215/15720656/24831/13426687|10511658/16777215/16777215/16777215/0/0/0/0/0/0 80 - 10.16.26.44 Java/1.6.0_37 200 0 0 959
    2014-05-01 18:24:56 192.168.251.10 GET /quotit/apps/leadspro/CrystalServiceGateway_test2.aspx @BrokerID=23433176 80 - 10.16.26.44 Java/1.6.0_37 200 0 0 742
    When we use the crystaldecisions.crystalreports.engine, no parameters are passed.  Here are the IIS log entries:
    2014-05-01 18:22:28 192.168.251.10 GET /quotit/apps/leadspro/CrystalServiceGateway_test2.aspx - 80 - 10.16.26.44 Java/1.7.0_45 200 0 0 58
    2014-05-01 18:22:28 192.168.251.10 GET /quotit/apps/leadspro/CrystalServiceGateway_test.aspx - 80 - 10.16.26.44 Java/1.7.0_45 200 0 0 115
    I cannot attach the rpt file here.  If you need it, please let me know how to get it to you.  I am attaching a screenshot of the datasource location.  I am pasting in the striped down .NET code.  Any help or pointers would be greatly appreciated.
    Thanks,
    Tom
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Configuration;
    using System.IO;
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared;
    using System.Collections;
    namespace CrystalTest
        class Program
            static void Main(string[] args)
                string source = Path.Combine(@"C:\Users\thomas\Desktop\reports\eProIFP\iProReports", "summaryReportByPremium_ACA_UltraColor.rpt");
                string destination = Path.Combine(@"C:\Users\thomas\Desktop\testReports", "output.pdf");
                if (File.Exists(destination))
                    File.Delete(destination);
                ReportDocument rptDoc = new ReportDocument();
                if (File.Exists(source))
                    rptDoc.Load(source);
                    rptDoc.SetParameterValue("@IFPPSID", "1899582751211388");
                    rptDoc.SetParameterValue("@styleColorScheme", "10511658/13343077/10511658/13343077/16777215/15720656/16777215/15720656/24831/13426687|10511658/16777215/16777215/16777215/0/0/0/0/0/0");
                    rptDoc.SetParameterValue("@testID", "1");
                    CrystalDecisions.Shared.TableLogOnInfo logOnInfo = new CrystalDecisions.Shared.TableLogOnInfo();
                    foreach (CrystalDecisions.CrystalReports.Engine.Table objTable in rptDoc.Database.Tables)
                        logOnInfo.ConnectionInfo.IntegratedSecurity = true;
                        objTable.ApplyLogOnInfo(logOnInfo);
                    ExportOptions CrExportOptions = new ExportOptions();
                    DiskFileDestinationOptions crDiskFileDestinationOptions = new DiskFileDestinationOptions();
                    crDiskFileDestinationOptions.DiskFileName = destination;
                    CrExportOptions = rptDoc.ExportOptions;
                    CrExportOptions.DestinationOptions = crDiskFileDestinationOptions;
                    CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                    CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
                    rptDoc.Export();

  • "Missing parameter values."  --  Export and Print only...

    I have a web application and I am using CrystalReportViewer.  I am passing several parameters to Crystal using: 
    report.SetParameterValue(field.Name, Session[field.Name]);
    I have session variables which will hold parameters needed to pass into the report.  The session variables are populated from controls on my webpage after an onclick event.  This even not only populates session, but also passes parameters to the report with the following code: 
    ReportDocument report = new ReportDocument();
    Session["MapPathName"] = "./Reporting/CaseStudy.rpt";
    report.FileName = Server.MapPath(Session["MapPathName"].ToString());
    ParameterFields fields = new CrystalDecisions.Shared.ParameterFields();
    fields = report.ParameterFields;
    foreach (ParameterField field in fields)
          report.SetParameterValue(field.Name, Session[field.Name]);
    CrystalReportViewer1.ReportSource = report;
    This works great for reporting and is very extensible.  However, when clicking on the "Print" or "Export" buttons on the toolbar I get "Missing parameter values."  I attempted to export manually in code using the .ExportToStream function but I still get the error, "Missing parameter values." 
    I received this error also in Refresh, Search, and Navigate functions.  This was corrected by calling a function that supplies the above code block to these functions.  However, I do not see any events for controlling the Print nor the Export events. 
    QUESTION: How can I print or export a report when passing parameters using CrystalReportViewer?  Thanks in advance!
    P.S. - Crystal Reports XI Release 2
    Edited by: KyleSavant on Jun 18, 2009 5:42 PM

    There are no Export or Print events accessible for the viewer
    Since it sounds like you are creating the reportdocument object in your click event, the settings on this object become out of scope on successive postbacks executed by other events.
    to get around this without major changes, you can place your "report" object in session in this event and retrieve it from session on successive postbacks.  This should solve your problems around navigation, printing and exporting.  What you will need to do is check if the session object exists (usually in page_load or page_initialze) and if so, retrieve it from session and bind it to the viewer's reportsource.  If the session object does not exist, then do nothing (ie you have not clicked your button yet that retrieves the parameter values from session and loads the report).  Also, in your click event you can check if the report session object exists and if so, remove it so that it can be re-created with your new parameter values (ie i'm assuming the only time you want to set parameter values is in this event).
    Dan

  • "Missing parameter values." Error when setting record selection formula

    Setup - VS 2008, CR 2008 (v12.0), Win XP & C#.Net
    I have a form which loops through all parameters (non-linked to sub reports, so only off the main report) and allows users to enter the values for each parameter. When hitting the preview button, I loop through all of the saved values, set the parameter field values and then add any additional filters into the recordselection formula as below. The problem i'm having is that the ReportDocument.HasRecords returns true if the ReportDocument.RecordSelectionFormula doesn't filter out every result.
    For example, I have a list of customers and if I set the selection formula to filter out a specific customer, ReportDocument.HasRecors returns true, if I set the selection formula to filter something that doesn't exist i.e. customer "xk39df", the moment this line of code runs "ReportDocument.RecordSelectionFormula = rsFormula;" - ReportDocument.HasRecors returns the following exception as opposed to "False".
    Message: Missing parameter values.
    Source: CrystalDecisions.ReportAppServer.DataSetConversion
    StackTrace:    at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.hasRecords()
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.get_HasRecords()
    ErrorID: MissingParameterFieldCurrentValue
    The strange thing is, it works fine if the recordselectionformula selects a record which exists in the results - all parameters have a current value except for the linked parameters.
    This one has got me stumped!
    foreach (ParameterFieldDefinition parameterField in ReportDocument.DataDefinition.ParameterFields)
                    var query = ReportObjects.Values.Cast<Filters>().Where(objects => objects.ParameterName == parameterField.Name.ToUpper().Trim());
                    foreach (var item in query)
                        parameterField.CurrentValues.Clear();
                        parameterField.CurrentValues.Add(item.ParameterValue);
                        parameterField.ApplyMinMaxValues(item.MinLength, item.MaxLengh);
                        parameterField.ApplyCurrentValues(parameterField.CurrentValues);
                var records = ReportObjects.Values.Cast<Filters>().Where(recordSelection => recordSelection.RecordSelectionFormula.Trim().Length != 0);
                foreach (var item in records)
                    rsFormula += item.RecordSelectionFormula;
                if (rsFormula.EndsWith(" AND "))
                    rsFormula = rsFormula.RTrim(5);
                ReportDocument.RecordSelectionFormula = rsFormula;

    Hi,
    The report has it's own ADO Datasource set in crystal reports, so I just pass the log on information to the report object before doing anything else.
    this.DataSourceConnections[0].SetConnection("ServerName", "Database", "sa", "Password");
    I then do a refresh before applying the parameter values (I do this because the user can preview the report more than one time by using a preview button on the parameter form without re-loading the report object)
    this.Refresh();
    Then I set all parameter values followed by setting the recordselection formula.

  • Missing parameter values on export

    Hi,
    I am using CR embedded edition 11.5.3.438 as the reports engine for a webapplication written in C# .NET framework 2.
    when i export a report to some formats (not rpt's) I get a "missing parameter values" exception.
    the code i use:
    private void ExportToMemory()
                   try
                        //export the report to the required format
                        //second param - reserved...
                        crystalBytes = crystalReport.PrintOutputController.Export(ConvertToCrysalExportFormat(format),0);
                   catch(Exception e)
                        //save this so it can be handled by the main thread
                        threadException = e;
    can anyone help?

    Hello, Dana;
    Are you passing the parameters to the ReportDocument object or to the Viewer?
    There is an article that may explain the issue [here|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_dev/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do].
    Elaine

  • Use of layout when more than one parameter - Error Missing Parameter Values

    Hi,
    Is it possible to use a crystal report which has more than one parameter as the layout for the bill of materials report.
    I have 3 parameters
           1. DocKey@       The Bill of Materials to be printed
           2. Number of levels to be printed
           3. type of levels to print.
    When I try to print it gives me the error Missing Parameter Values.
    I have tried changing the DocKey@ to CodeKey@ but the same error.
    Does anyone now where to find a list of these tokens?
    Thanks
    Chris

    I looked at the crystal report conversion to try to find what parameters it used and found none.
    I have managed to create and use a crystal report to replace the production order using DocKey@ as the parameter.  This works within SAP.  However I have converted the system production order to crystal reports and from the converted report I cannot see any parameters at all.
    How and where can you find out what paramters you need to use to replace any PLD report?  Several reports have multiple selection criteria before the report prints.  How can you find out what their tokens are called?  I am starting to pull my hair out.  I am getting great help from this forum, but do you know any documentation which actually explains this area.
    Thanks
    Chris

  • Missing Parameter Values - C# - Pushing Datatables to feed data to Report

    Hello,
    I am working on a .NET project to process close to 650 "existing" reports developed in Crystal Reports 8.5. Rendering reports without subreports is working just fine. However I am getting the following error everytime I try to render a report that has multiple subreports
    Missing parameter values. at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
    Following is how the reports are built.
    Main Report - Fed with a Datatable whose name corresponds to the name of the SQL Query configured in Crystal UI
        SubReport1 - Fed with a Datatable whose name corresponds to the name of the SQL Query configured in Crystal UI. The                           subreport is linked to the parent report using one of the fields in the Datatable that is passed to the main report.
    Example: the main report receives a datatable with the following fields
    EmployeeId (integer), EmployeeName (string)
    The subreport receives a datatable with the following fields : EmployeeId (Integer), EmployeeHobbies (string)
    The link is established as follows:
    SubReportQueryName.EmployeeId link to MainReportQueryName.EmployeeId
    _I have checked the data, its correct in terms of the fields required to render the report. The report parameters are being set from the code and ApplyCurrentValues is being called to ensure that the set values are used when rendering the report.
    Please note that I am not using live connections to the database
    I tried saving a copy of the above mentioned report and removing the subreport and then rendering the report, all works fine. However the moment i introduce the subreport, per the above mentioned report design/architecture all hell breaks loose and i cannot render the report.
    The environment is Windows Vista and I am running VS 2008.
    Any help is appreciated.
    Thanks
    Edited by: pkumbhat on Sep 15, 2010 4:43 PM

    The issue has been dealt with.
    The solution is to set the datasource with a dataset even if the report or subreport expects or is configured to work with a single table.

  • "Missing parameter values " when passing parameter to subreport

    i have a subreport embedded in main report.
    sub report take a procedure with parameter.the main report does nothing but only holds many sub report.now i have to pass parameter from code to sub report.ive used the following code but it gives "missing parameter values" error
    Any help??
       ParameterField paramField = new ParameterField();
            ParameterFields paramFields = new ParameterFields();
            ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
            paramField.Name = "@LabNo";
            paramDiscreteValue.Value = "1034";
            paramFields.Add(paramField);
            ParameterValues paramvalues = new ParameterValues();
           paramvalues.Add(paramDiscreteValue);
            paramField.CurrentValues.Add(paramDiscreteValue);
    rptDocument.ParameterFields[0].CurrentValues = paramvalues;

    does the sub report have parameters in it as well?
    if the sp used for the sub report has parameters you need to pass them to the sub. i would probably remove the parameters from the sub and join the sub to the main by the parameter from the main to the field in the sub.

  • Why do I get Missing Parameter Values error from CrystalReportViewer in VS2005

    Post Author: eseidel
    CA Forum: .NET
    Hi everyone,
    I have spent way to much time trying to figure this problem out and am getting no where now. I was hoping someone with more experience in CR for VS2005(I think v.9) and VS2005 may be able to help.  I have a report with 10 parameters that Im setting in code.  I have another 3 parameters in a subreport(with same names as 3 in main report) that are being pushed in(I hope) through my ApplyParams() method.  I have checked the output of each parameter before and after it is assigned in ApplyParams.  All values are being set....So why do I keep getting an error when I run it for Missing Parameter Values no matter what I do?  The error comes after SetDBLogonForReport(myConnectionInfo).  I have been struggling with this problem for almost 3 days now and have tried numerous approaches.  If I remove the subreport it works ok.  Why is subreport not getting parameters(I think this is where the problem stems from)?  Please any advice would be greatly appreciated.  Thank you. If need be I can e-mail the report but I don't know how much that will help without being able to access the datasources.
    Eric
    Code Snippet
    Private _Parameters As New System.Collections.Specialized.StringDictionary
    Public Property Parameters() As System.Collections.Specialized.StringDictionary
         Get
             Return (_Parameters)
         End Get
         Set(ByVal Value As System.Collections.Specialized.StringDictionary)
            If (Value Is Nothing Or _Parameters Is Nothing) Then Exit Property
            For Each entry As DictionaryEntry In Value
                _Parameters.Add(entry.Key, entry.Value)
            Next
       End Set
    End Property
    Private Sub SetParameters()
        Parameters("kiPerformance") = rptKi.ToString
        Parameters("PreparedBy") = rptPreparedBy
        Parameters("SupplierName") = rptSupplierName
        Parameters("Supplier") = rptSupplier  'Param in subreport too
        Parameters("ApprovedBy") = rptApprovedBy
        Parameters("kiPerformanceGoal") = rptKiThisGoal.ToString
        Parameters("kiForecastGoal") = rptKiForecast.ToString
        Parameters("kiNextGoal") = rptKiNextGoal.ToString
        Parameters("kiBegRange") = rptBegDate.ToString("d") 'Param in subreport too
        Parameters("kiEndRange") = rptEndDate.ToString("d") 'Param in subreport too
    End Sub
    Public Function ApplyParams()
        Me.SuspendLayout()
        Dim rpt As CrystalDecisions.CrystalReports.Engine.ReportDocument = _
        crv.ReportSource
        If (rpt Is Nothing OrElse _Parameters Is Nothing) Then Return False
        Dim crParameterFieldDefinitions As ParameterFieldDefinitions = rpt.DataDefinition.ParameterFields
         If (crParameterFieldDefinitions Is Nothing) Then Return False
         For Each crParameterFieldDefinition As ParameterFieldDefinition In crParameterFieldDefinitions
             If ((Not crParameterFieldDefinition.IsLinked) And _
                 _Parameters.ContainsKey(crParameterFieldDefinition.Name)) Then
                   Dim crParameterValues As ParameterValues = _
                   crParameterFieldDefinition.CurrentValues
                   If Not (crParameterValues Is Nothing) Then
                         Dim crParameterDiscreteValue As New ParameterDiscreteValue
                         crParameterDiscreteValue.Value =  _Parameters.Item(crParameterFieldDefinition.Name)
                         crParameterValues.Add(crParameterDiscreteValue)
                         'Console.WriteLine(crParameterFieldDefinition.Name & ": " & crParameterDiscreteValue.Value)
                        crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
                  End If
              End If
           Next
           crv.ReportSource = rpt
           Me.ResumeLayout()
           Return Nothing
    End Function
    Private Sub ConfigureCrystalReports()
            Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo
            Dim pFields As New ParameterFields()
             Dim pField As New ParameterField()
             Dim disVal As New ParameterDiscreteValue()
             'Connection stuff,sorry I can't show you this part
             'Bind report
            rptCard = New ReportCard
           LoadDataSource()
           rptCard.SetDataSource(dsOcc)
           rptCard.Subreports("FailOcc").SetDataSource(dsOcc)  'Ive tried without this line as well
           rptCard.PrintOptions.PaperSize = PaperSize.Paper11x17
           rptCard.PrintOptions.PaperOrientation = PaperOrientation.Landscape
           crv.ReportSource = rptCard
           'Load parameters for report
           SetParameters()
           crv.RefreshReport()
           SetDBLogonForReport(myConnectionInfo)
    End sub
    Private Sub SetDBLogonForReport(ByVal conn As ConnectionInfo)
             Dim tableLogOnInfos As TableLogOnInfos = crv.LogOnInfo
             For Each myTableLogOnInfo As TableLogOnInfo In tableLogOnInfos
                  myTableLogOnInfo.ConnectionInfo = conn
             Next
    End Sub
    Private Sub crv_Error(ByVal source As Object, ByVal e As CrystalDecisions.Windows.Forms.ExceptionEventArgs) Handles crv.Error
          MsgBox(e.Exception.Message)
          e.Handled = True
    End Sub
    Private Sub crv_ReportRefresh(ByVal source As Object, ByVal e As CrystalDecisions.Windows.Forms.ViewerEventArgs) Handles crv.ReportRefresh
           ApplyParams()
    End Sub

    Post Author: mewdied
    CA Forum: .NET
    By any chance are the parameters in your subreport stored procedure parameters?
    There was a specific fix for stored procedure parameters available from:ftp://ftp1.businessobjects.com/outgoing/CHF/crnet20win32x86_en_chf.zip
    The specific fix is described in the readme under Problem ID # ADAPT00532856

Maybe you are looking for

  • Error when deploying EAR in OC4J 10.1.3.0.0 with a deployment plan

    Hello! I try to deploy an ear file specifying a deployment plan generated from web interface using command line utilities. I try to use both admin_client.jar and oracle ant task and still get the same error. When i remove deployment plan argument, th

  • Problem in sending drop down list value to jsp page showing  null value

    i am trying to send a drop down list value from client side to a jsp page but getting null value this is first page where i have accessed data from database and putted it in a drop down list <select name="sub">      <%      while(rs2.next())      cat

  • Photoshop Elements 9 Editor not showing images in Project Bin

    Yesterday I went though my PE9 Organiser and rearrange some of my files and made sure that it was more user friendly. Today I went in to try and do some edits and not all of the folders are showing up in PE9 Project Bin. I can view some images, but n

  • Airport time access control not working for iPhones-

    Hi, I use a 3rd generation Airport Extreme base for my WiFi hme network. For parental control, I'd like to allow one iPhone and iMac to be connected only for some hours of the day. So I have activated the timed access control and entered the relevant

  • Executing .CLASS file

    Hello, I recently had my machine reimaged and I'm trying to configure it to execute Java class files from the command prompt. After manipulating the PATH and CLASSPATH system variables I was able to get it to the point where I can compile .JAVA sourc