locked
CrystalReportViewer does not show parameter field RRS feed

  • Question

  • User-1214731955 posted

    Hello

    I have a report that calls a stored procedure. The report displays many fields from the procedure, and also some formula fields and two parameters the application passed.

    When it is called from the app, all the fields have the correct values, except the parameters fields. They come empty.

    If I open the report using crystal reports application, those fields are displayed correctly.

    I don't know if the problem is in my code, or on the report file.

    My code is something like this:

    ReportDocument cryRpt = new ReportDocument();
    cryRpt.Load(_PathRpt);
    SetupReport(cryRpt); //Set connection
    
    cryRpt.SetParameterValue(0, Request.QueryString["dt01"].ToString());
    cryRpt.SetParameterValue(1, Request.QueryString["dt02"].ToString());
    
    cryRpt.DataDefinition.FormulaFields["Formula01"].Text = "'xxx'";
    cryRpt.DataDefinition.FormulaFields["Formula02"].Text = "'zzz'";
    
    CrystalReportViewer1.ReportSource = cryRpt;

    Anybody can help me on this?

    Thanks

    Wednesday, February 15, 2012 9:46 AM

All replies

  • User-37275327 posted

    make sure you have set parameter correctly, parameter name after para value

    http://devlibrary.businessobjects.com/businessobjectsxir2/en/en/CrystalReports_dotNET_SDK/crsdk_net_doc/doc/crsdk_net_doc/html/crlrfCrystalDecisionsCrystalReportsEngineReportDocumentSetParameterValueTopic.htm

    Thursday, February 16, 2012 5:12 AM
  • User-1214731955 posted

    Hello cnranasinghe

    I checked the parameters and they are been passed correctly. Both the report and the procedure receive the desired values and returns the correct results. Only the parameter fields placed on the report header are empty.

    I also tried the code below:

    CrystalDecisions.Shared.ParameterDiscreteValue crParameterDiscreteValue01 = new CrystalDecisions.Shared.ParameterDiscreteValue();
    crParameterDiscreteValue01.Value = _dtIni;
    cryRpt.ParameterFields[0].CurrentValues.Add(crParameterDiscreteValue01);
    cryRpt.DataDefinition.ParameterFields[0].ApplyCurrentValues(cryRpt.ParameterFields[0].CurrentValues);
    

    But it didn't work neither.

    Thank you anyway.

    Thursday, February 16, 2012 6:42 AM
  • User-37275327 posted

    Try moving parameter fields to different section. Also check forecolor of paremeter is equal to background color.

    Thursday, February 16, 2012 10:24 PM
  • User-1214731955 posted

    Try moving parameter fields to different section. Also check forecolor of paremeter is equal to background color.

    I don't think this is the problem, because when I call the report from Crystal app, or from Visual Basic, it works fine, I mean, the parameter fields placed in the header section are displayed correctly. They are empty only when I call the report from the web, using CrystalDecisions.Web.CrystalReportViewer.

    I already thought about a workaround to fix this issue. I can place a formula field instead of parameter field. I know it will work, but I will use this option only if I can't solve the real problem.

    Regards

    Friday, February 17, 2012 4:53 AM