"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

Similar Messages

  • 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();

  • Error printing Check - "Missing Parameter Values. Error During Printing"

    Dear friends,
    Our client is in SAP B1 8.81 Pl07 and is facing an error while printing checks designed in Crystal Reports. As soon as they click on "Print" button, we are getting an error "Missing Parameter Values. Error During Printing".
    We have checked the Crystal Reports and all the parameters are given.
    Can anyone help me regarding this?
    Thanks and regards,
    Bharath S

    hi,
    Quoted from Note 1555170
    1555170 - Error 'Missing parameter values' printing with CR layout
    Symptom
    When you print on add any stock transactions document, with Crystal report layout, you receive error message:'Missing parameter values' and then 'Error during the printing; ensure all parameters are defined'
    Step by Step scenario:
    1.Go to Administration / System Initialization / Print preferences and select the tab per document.
    2.Select the document stock transfer and tick the box print document when adding document and click on update.
    3.Go to stock management / stock transactions / stock transfer
    set the Crystal report template as default.
    Note:
    - The issue is reproduced also for Goods Receipt and Good Issue.
    - The issue is reporduced with any Crystal Report Template  for the     above documents.
    Cause
    Program error
    Solution
    This issue is candidate for a change in a future release of SAP Business One.
    Workarounds:
    1.Use PLD for printing the stock transactions.
    2.Convert the PLD layout to Crystal reports with Crystal converter.
    3.Print the document after adding it.
    Other terms
    sap business one, printing issues, good issue, good receipt, stock transfer, crystal report, print preferences, print when adding, dockey, missing parameter
    Header Data
    Released on     07.02.2011 13:27:30
    Release status     Released for Customer
    Component     SBO-REP-CR Crystal Reports 2008 for SAP Business One
    Other Components     
    SBO-GEN-PRT Printing Issues
    Priority     Correction with low priority
    Category     Program error
    Validity
    Software Component
    Version
    SAP BUSINESS ONE
    8.8
    8.81
    you can download the PLD to Crystal Converter [here|http://www.sdn.sap.com/irj/scn/downloads?rid=/library/uuid/108305a7-1555-2d10-8289-9a178d441c71]
    regards,
    Fidel

  • Error Missing parameter values - I get this in 11g app server only

    Hi.. I had an application in JSP-Struts, previously on 10g app server.  I now migrated the code into 11g. 
    I get the error on CrystalViewer.jsp 
    Error
    Missing parameter values
    Steps that lead up to the error:
    The very first time anyone enters the application and clicks a submit button on the jsp, after entering data and/or picking from drop menus, the error shows up on a separate page (thrown by crystalViewer.jsp)
    When I get this error, and click the browsers back button, and simply click the submit button on the jsp screen again, the reports work fine (like they do in 10g).
    Tried the following:
    I used log4j and followed the data as it made its way from Struts to Crystal Factory.  But once it gets out of Struts, and forwards to Crystal, I receive the error from the CrystalViewer.jsp
    Next, I removed code in struts-action, that used crystal factory to 'set parameter', and didnt send any parameters, letting my crystal report bring back some random records.. And this works even the first submit!  So the problem is only when I have to send parameters to crystsl
    Additional info:
    I do not send any null values across, since I read on these forums that folks were having issues with setting nulls etc... I check for null and then force 'All' in the parameter if the user does not enter data or pick from the drop-down.
    I need help resolving this . Thanks and have a great day.
    (Are there any changes to be made to the Struts config, or any additions to Web.xml? Should Crystal reports be changed in anyway so they can function like they did in 10g?)

    The Crystal SDK doesn't know or care that you're using Struts. 
    The exception is stating you're not setting parameters. 
    So wherever you're trying to set parameters, whatever's reaching the viewer don't have them set.
    Why not trace the workflow to see what's where?
    Sincerely,
    Ted Ueda

  • 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.

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

  • CR Viewer tool bar images are missing; Export and Print are not working

    Hi There
    I used Crystal report 10.5(VS 2008 base crytal report -- CRRedist2008_x86.msi), i developed ASP.net application using VB.net  program(i used .net 3.5). One of the pages in the application is having crystal report viewer, which is calling a crystal report to populate the result. The report is working as expected on development machine (Win Vista). Hence, I moved the application onto Server (Windows Server Web; 32Bit OS and IIS). I installed the CRRedist2008_x86.msi, which added the "aspnet_client" under default website. As my site is a made as an application under default webiste. I tried...
    a) By copying the aspnet_client folder into the website folder
    b) By adding a virtual directory called "aspnet_client" under my website pointing it into the folder under "default website"
    None of the trials are working for me.
    When I click on Print or Export buttons (although their images are missing), I get the error sigh on bottom left (status bar) of the browser and the popping up the same giving me below error details
    Webpage error details
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; HPNTDF; InfoPath.3; MS-RTC LM 8; .NET4.0C)
    Timestamp: Tue, 2 Nov 2010 15:11:12 UTC
    Message: Object doesn't support this action
    Line: 41
    Char: 1
    Code: 0
    URI: http://65.123.xxx.x:37188/xyzweb/(S(uhgxkx45iwlrbancwzfunp55))/reportpage.aspx
    Any help in resolving this issue would be greatly appreciated.
    Thank You,
    Edited by: skbo007 on Nov 2, 2010 4:11 PM

    Hello All.
    I am excited to let you know that the issue is being resolved.
    Here is steps that lead me to resolution and solution..
    I installed Fiddler2 and looked into every the debugging details of the transaction while running the report.
    Learned that the crystal report is using the aspnet_client foler under "Default website" NOT under the crrent website.
    Hence I tried to access the image via http path from local machine
    http://myserver/aspnet_client/system_web/2_0_50727/CrystalReportWebFormViewer4/images/toolbar/export.gif.
    (Notice, "mysite" folder is been removed)
    I was expecting to see the gif on my browsers' body. It gave me an error.
    Investigated further more on the error and found that the "Managed Pipe Line" of the respective application pool is to be changed to "Classic" instead of "Integrated"
    changed it .. Boom...
    Tool bar is showing up with proper images and as well the "Export" and "Print" functions are working as expected..
    Hope this helps to those in the same situation.
    Again.. this is one of many many solutions on this issues.
    Thank You
    Edited by: skbo007 on Nov 3, 2010 9:42 PM

  • 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

  • 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

  • Export and Print icons missing from report viewer

    I'm currently embedding crystal within a wicket application in which I'm making use of the getHtmlContent() method to retrieve the report's HTML.  For whatever reason, I'm not able to get either the export or print icons (on the top left side of the viewer).  Is this because I'm using the getHtmlContent() method or do I have something misconfigured somewhere?  Setting the setHasExportButton(true) and setHasPrintButton(true) on the report viewer object has no effect. 
    If I run the same report using the generated JSP outside of my application (within tomcat), I see the export/print buttons.  I notice the JSP makes use of the processHttpRequest() method.  Any help will be greatly appreciated.
    Thanks!
    Louis

    Hi Louis
    - The getHtmlContent() method handles the user's request to generate the HTML for the report and returns the HTML as a String.
    Note: Either the getHtmlContent method or the processHttpRequest method can be used to handle the user's request to generate the HTML for the report, depending on how you write your JSP. If the viewer's content is displayed more than once, then the getHtmlContent method is more efficient, because the request is processed once and the resulting HTML string can be used multiple times. In this case, you must set the content type of the HTML, as recommended in the table. Additionally, using getHtmlContent sets setOwnPage to false and disables exporting and printing.
    - The setOwnPage(true) and  processHttpRequest() method should be used if you want the export and print button to appear in the report viewed through Crystal Report Viewer.
    Following is the snippet of code which shows you how to use these 2 methods.
    //Get the IReportSource object from sesion and pass it to the viewer
         IReportSource reportSource = (IReportSource)session.getAttribute("reportSource");
    Create the viewer and render the report -
         //create the CrystalReportViewer object
         CrystalReportViewer oCrystalReportViewer = new CrystalReportViewer();
         //set the reportsource property of the viewer
         oCrystalReportViewer.setReportSource(reportSource);
         //set viewer attributes
         oCrystalReportViewer.setOwnPage(true);
         oCrystalReportViewer.setOwnForm(true);
         //set the CrystalReportViewer print mode
         //oCrystalReportViewer.setPrintMode(CrPrintMode.ACTIVEX);
         oCrystalReportViewer.setPrintMode(CrPrintMode.PDF);
         //process the report
         oCrystalReportViewer.processHttpRequest(request, response, getServletConfig().getServletContext(), null);
    Hope this helps you .
    Thanks
    Soni

  • CRVS2010 Beta - Missing parameter values

    I want to export my report to pdf file and I want to set some parameters in report in runtime.
    But when I try to do it I have exception "Missing parameter values".
    Productversion: Visual Studio 2010 + Crystal Report 2008 + service pack v3.
    I read that problem was resolved in service pack v2.
    But now I don't have any idea how to fix my problem.
    I create report and add parameters ("MyParameter") as string.
    My test project:
    //Load report
    //Set db connection
    try
                            ParameterValues crParameterValues = report.DataDefinition.ParameterFields["MyParameter"].CurrentValues;
                   ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue {Value = "SBSUrl"};
                   crParameterValues.Clear();
                   crParameterValues.Add(crParameterDiscreteValue);
                   report.DataDefinition.ParameterFields["MyParameter"].ApplyCurrentValues(crParameterValues);
                   report.VerifyDatabase();
                   report.Refresh();
                      string reportFileName = string.Format(@"D:\CrystalReport\CRResult-{0}.pdf", DateTime.Now.Ticks);
                      ExportOptions rptExportOption;
                      var rptFileDestOption = new DiskFileDestinationOptions();
                      var rptFormatOption = new PdfRtfWordFormatOptions();
                      rptFileDestOption.DiskFileName = reportFileName;
                      rptExportOption = report.ExportOptions;
                           rptExportOption.ExportDestinationType = ExportDestinationType.DiskFile;
                           rptExportOption.ExportFormatType = ExportFormatType.PortableDocFormat;
                           rptExportOption.ExportDestinationOptions = rptFileDestOption;
                           rptExportOption.ExportFormatOptions = rptFormatOption;
                      report.Export(); //  I have exception here ("Missing parameter values.")
                 catch (Exception e)
                      Console.WriteLine(e);
              private void SetCurrentValuesForParameterField(ReportDocument reportDocument, ArrayList arrayList)
                   ParameterValues currentParameterValues = new ParameterValues();
                   foreach (object submittedValue in arrayList)
                        ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
                        parameterDiscreteValue.Value = submittedValue.ToString();
                        currentParameterValues.Add(parameterDiscreteValue);
                   ParameterFieldDefinitions parameterFieldDefinitions = reportDocument.DataDefinition.ParameterFields;
                   ParameterFieldDefinition parameterFieldDefinition = parameterFieldDefinitions["MyParameter"];
                   parameterFieldDefinition.CurrentValues.IsNoValue = true;
                   parameterFieldDefinition.ApplyCurrentValues(currentParameterValues);
    Could anybody help me with this exception?

    Make sure you log on to the database, set the parameter, then export.
    See the following KBases:
    [1244475 - Error: Missing parameter value when exporting a Crystal Report with optional parameters using the CR .NET SDK|http://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]
    [1215426 - Err Msg: Missing parameter value when printing or exporting in VS .NET|http://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]
    [1215536 - Err Msg: Missing parameter field current value when exporting/printing in .NET|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do]
    [1216546 - Err Msg: Missing Parameter Field Current Value when viewing a report in VS.NET|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do]
    Also, see the following forum thread for possible solutions:
    Passing Parameters CR 2008 VS 2008 ASP.net
    Ludek

  • Missing Parameter Values CR2008 Optional Parameter

    Hi,
    I am getting "Missing Parameter Values" error
    "CrystalDecisions.CrystalReports.Engine.ParameterFieldCurrentValueException: Fehlende Parameterwerte. ---> System.Runtime.InteropServices.COMException (0x8004100E)"
    if I try to export a Report with an optional Parameter without setting the parametervalue.
    The Report works fine with ReportViewer.
    If I uncomment the "Parameterpart" and set a parametervalue it works fine, but it should works without a parametervalue too, its optional.
    I have tried many for a long time and read many Websites but it does not work !
    I use WinXP SP2 CR2008 with C# .NET 2.0 VS2005
    CrystalDecisions.CrystalReports.Engine.dll version 12.0.2000.683 Date: 2008-03-01
    CrystalDecisions.Shared.dll version 12.0.2000.683 Date: 2008-03-01
    Sorry my English is very Bad !
    Thanks a lot!
    ExportFormatType ExportType = ExportFormatType.PortableDocFormat;
                ReportDocument RD = new ReportDocument();
                RD.Load("C:\\ParaTest01.rpt");
                string strServer = "<ServerName>";
                string strDB = "<DBName>";
                string strUser = "<UserID>";
                string strPW = "<PW>";
                RD.SetDatabaseLogon(strUser, strPW, strServer, strDB);
                //ParameterFieldDefinitions crParameterFieldDefinitions = RD.DataDefinition.ParameterFields;
                //ParameterFieldDefinition crParameter1 = crParameterFieldDefinitions[0];
                //ParameterValues crParameter1Values = crParameter1.CurrentValues;
                //ParameterDiscreteValue crDiscrete1Value = new ParameterDiscreteValue();
                //crDiscrete1Value.Value = "GER";
                //crParameter1Values.Add(crDiscrete1Value);
                //crParameter1.ApplyCurrentValues(crParameter1Values);
                RD.ExportToDisk(ExportType, "C:\\Test2.pdf");
    RecordSelectionFormula in Report:
    (not HasValue({?Land}) OR {tab.location_code} = {?Land}) and
    {tab.sup} = "XXX" and
    {tab.Accounting_Period} = "200801"

    You need to be careful when using optional parameters. If you are using the optional parameter in a record selection formula you'll need to check and make sure it has a value before you use it. There is a function call HasValue() that you can use to do this.
    If you have an optional parameter in the record selection formula and you don't pass a value you'll need to make sure your selection formula can be completed with out it.
    This is an excerpt from our help file.
    Crystal Reports supports optional parameters. An optional parameter is a prompted value that does not have to be supplied by the user.
    Report designers should provide some guidance to the end user that a parameter is optional by adding this information to the prompt text.
    Optional parameters are treated by Crystal Reports as optional anywhere within the report that they are used. You cannot set one instance of the parameter to optional and another to mandatory.
    Note: After you set a parameter to optional, if you use the Select Expert, the system will automatically add the selection formula for you using the HasValue() function.
    The Formula Workshop Editor does not automatically add the formula. Only the Select Expert automatically adds the formula for you.
    If you change the parameter from optional to mandatory, the HasValue() function is not automatically removed from your formula.
    Handling a parameter with no value
    When the report engine evaluates any formula which references an optional parameter that does not have a value, it generates a runtime error. All formulas that reference an optional parameter should first use the HasValue() function to check if that parameter has a value before evaluating it. This includes record selection formulas and saved data formulas.
    Note: The system will not automatically drop a statement from the SQL WHERE clause. It is the report designeru2019s responsibility to decide which statement to leave out based on HasValue() testing.

  • "Missing parameter value" error on autoprinting with CR layout

    Hi all, i had recently run into the following:
    document layouts that work perfectly from preview and after adding a document, dont work if the document is auto printed on add.
    Gives an error:
    missing parameter value
    And in system messages log:
    Error during printing: ensure all parameter values are defined.
    With only @dockey token  present in the layouts (so no other parameter).
    What makes me wonder is that this doesn't happen to all the layouts, most of them works perfectly the same way (only dockey parameter, autoprint is set etc.) but the stock related documents do this on add.
    Any ideas?
    I found a likely issue in note 1466274 but it's listed as fixed in 8.8 PL 13, we are on PL 15. Could reproduce on PL 18.
    Thanks and regards.
    Daniel

    Hi Gordon.
    I could reproduce on the test copy of the db even on different patch levels.
    Can this be the almost same issue as stated in the note? I mean same code problem but at another point?
    Yesterday i found another example:
    uppon exiting the dunning wizard with print and exit option allmost the same error. The difference is that beforehand the same error messages one pops up with the following:
    title:Crystal Reports Windows form viewer
    "A report application server meghibásodott." (this is even with sap b1 gui langugage set to english)
    "The Report application server crashed/broke down(?)"
    Will try to test it on the demo database now..
    Any ideas?
    Thank you.
    Regards.
    D
    Edited by: Daniel Omaisz Takacs on Feb 1, 2011 9:09 AM

  • 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

  • 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.)

Maybe you are looking for