cancel
Showing results for 
Search instead for 
Did you mean: 

Why is the report prompting for parameters when there is a subreport in it?

Former Member
0 Kudos

Hello all,

I am in the process of upgrading from Crystal Server 2008 Embedded to Crystal Server 2013 Embedded.

In the current version (2008) I have a series of reports that have subreports on them and they all work fine.

Now, whenever I run the exact same reports (without any modifications made to them), the report keeps prompting for the parameter values.

I know that this is related to the subreports, because when I disable them, the report is properly displayed, but I need the subreports to be there.

The parameters used by the subreport are created using the "Change Subreport Links" dialog and the "Select data in subreport based on field" option is checked.

The report is embedded in an aspx form, and the code that I use to assign the parameters to the main report is the following (relevant parts in bold):

private void ParametersLoad(XmlDocument paramDoc, XmlDocument criteriaDoc)

{

    if ( currentReport.DataDefinition.ParameterFields.Count > 0 )

    {

        CrystalDecisions.ReportAppServer.DataDefModel.ParameterField tempParam;

        CrystalDecisions.ReportAppServer.Controllers.ParameterFieldController paramController;

        CrystalDecisions.ReportAppServer.DataDefModel.ParameterFieldDiscreteValue discreteVal;

        string sFieldName;

        string sValue;

        XmlNode paramNode;

        bool isStoreProcParam = false;

       

        foreach ( CrystalDecisions.ReportAppServer.DataDefModel.ParameterField paramField in currentReport.DataDefinition.ParameterFields )

        {

            sValue = "";

            tempParam = new CrystalDecisions.ReportAppServer.DataDefModel.ParameterField();

            paramField.CopyTo(tempParam, true);

            sFieldName = paramField.Name;

            isStoreProcParam = false;

            if (sFieldName.Trim().StartsWith("@")) //Case of store proc parameter

            {

                sFieldName = sFieldName.Substring(1);

                isStoreProcParam = true;

            }

            switch (sFieldName)

            {

                case "sysLocaleID":

                    sValue = UserLocale.ToString(); //Get User Locale

                    break;

               // logic for other variables that have a preset name

                default:

                    paramNode = paramDoc.SelectSingleNode("//Parameter[Name='" + sFieldName + "']");

                    if (paramNode != null)

                        sValue = paramNode.SelectSingleNode("Value").InnerText;

                   

                    if (sValue == "")

                    {

                        if ((paramField.Type <= CrystalDecisions.ReportAppServer.DataDefModel.CrFieldValueTypeEnum.crFieldValueTypeCurrencyField))

                            sValue = "0";

                        else if (paramField.Type == CrystalDecisions.ReportAppServer.DataDefModel.CrFieldValueTypeEnum.crFieldValueTypeDateTimeField)

                            sValue = @"01/01/1900";

                    }

                    else if (paramField.Type == CrystalDecisions.ReportAppServer.DataDefModel.CrFieldValueTypeEnum.crFieldValueTypeDateTimeField)

                    {

                        DateTime dtValue = DateTime.Parse(sValue);

                        sValue = dtValue.ToString("G");

                    }

                    break;

            }

           discreteVal = new CrystalDecisions.ReportAppServer.DataDefModel.ParameterFieldDiscreteValueClass();

            if (sValue.Trim() != "")

                discreteVal.Value = sValue;

            else if (isStoreProcParam)

                discreteVal.Value = null;

            else

                discreteVal.Value = "";

            tempParam.CurrentValues.Add(discreteVal);

            paramController = currentReport.DataDefController.ParameterFieldController;

            paramController.Modify(paramField,tempParam);

        }

    }

}

I have looked in many forums and I found a case that was remarkably similar, which is described here:

Unfortunately, this case has no solution yet, but it was logged 3 years ago, so I hope that something exists to prevent this scenario now.

Thanks in advance,

Hector

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

This is not the optimal solution, but...

Have you tried recreating the main report and re-importing the subreport (in a newer version of crystal reports)?

Former Member
0 Kudos

Hello Pez,

I have avoided doing precisely that because I have a large number of reports with subreports in them and I wouldn't like to rebuild all of them.

I'd very much like to find a code-related solution for this, or maybe find out if this is an issue with Crystal Server.

But I will try your suggestion with one report, see if that's one way to work around this problem.

Thanks!

Former Member
0 Kudos

Hector,

I was just curious if recreating the reports in a newer version of crystal designer resolved the issue or even after that it's still giving you errors.

Former Member
0 Kudos

Hello Pez,

No, I haven't tried that because, as I mentioned before, we have many reports with subreports on them and we would prefer not to end up recreating all of them (assuming that doing that would correct the issue).

I created a support ticket with SAP to see if they could help me figure out what the problem is, but nothing that we have tried so far has been successful.

Since these reports work properly in Crystal Server 2008, I would think that there is something broken in Crystal Server 2013, but we haven't confirmed that yet.

Regards,

Hector

0 Kudos

Hi Hector,

What is the case number?

What SDK package you using?

Does it match the same version of CRSE?

Can you attach one of your reports to this post, add .txt to the rpt file. I don't need data.

Have you tried my Parameter test app using CR for VS? Don't install it on the same PC as your BOE .NET SDK package, it can break things.

Try it. And as a test only do as Pez suggests just to verify if it the report causing the issue.

Don

0 Kudos

Hi Hector,

What is the case number?

What SDK package you using?

Does it match the same version of CRSE?

Can you attach one of your reports to this post, add .txt to the rpt file. I don't need data.

Have you tried my Parameter test app using CR for VS? Don't install it on the same PC as your BOE .NET SDK package, it can break things.

Try it. And as a test only do as Pez suggests just to verify if it the report causing the issue.

Don

Former Member
0 Kudos

Hello Don,

The case number is 84871/2016.

I am using the SAP BusinessObjects BI Platform .NET SDK Redistributable 32bit 4.1 SP7, which matches the SAP Crystal Reports Server 2013 SP7, OEM Edition I'm working with.

I'm not sure I can attach one of my reports to the site, I don't see an option to do that.

And no, I haven't tried the tool that you mention. Let me look into it to see if it can be of any help.

For what it's worth, I think that the problem may be related to the events in the aspx page, because I created a windows forms app and the report runs there without a hitch.

But the same aspx page runs without a problem when pointed to CRSE 2008 (just with different libraries). So I don't know if something changed from one version to the other or if I'm supposed to run things differently.

Thanks!

Hector

0 Kudos

Update... This works...

Hi Hector,

I simplified it as much as I can by first updating the report with the correct XML file and then simply using this simple test app to verify, so no log on info just setting the values:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using CrystalDecisions.ReportAppServer.ClientDoc;

using CrystalDecisions.ReportAppServer.Controllers;

using CrystalDecisions.ReportAppServer.DataDefModel;

public partial class _Default : System.Web.UI.Page

{

    ReportClientDocument boRpt;

    protected void Page_Load(object sender, EventArgs e)

    {

boRpt = new ReportClientDocument();

boRpt.ReportAppServer = "127.0.0.1";

boRpt.Open("C:\\Atest\\84871\\SecurityUserGroupAccessDon.rpt");

boRpt.DataDefController.ParameterFieldController.SetCurrentValue("", "sysLocaleID", "5");

boRpt.DataDefController.ParameterFieldController.SetCurrentValue("", "sysSitePath", "5");

boRpt.DataDefController.ParameterFieldController.SetCurrentValue("", "sysSiteURL", "5");

CrystalReportViewer1.ReportSource = boRpt;

    }

}

Don

Answers (0)