Skip to Content
0
Former Member
May 14, 2010 at 03:30 PM

Parameter in linked Subreports

28 Views

I have a Report with several subreports.

The data of the main report comes from a stored procedure (Microsoft SQL Server) with a parameter @intFKCutomer.

The data for the subreport comes from a second procedure with the same parameter.

Now I want to link these parameters because I don't want to set them both apart.

Therefor I linked the Parameter Field (@intFKCutomer) direktly with the Parameter Field of the subreport.

And then I set the Parameter from the C# Code in this way:

public void RefreshReportParameter(string inParameter, object inParameterValue)
        {
            try
            {
                    foreach (CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition mainParam in this.GetReport().DataDefinition.ParameterFields)
                    {
                        if (mainParam.Name == inParameter)
                        {
                            if (mainParam.ReportName == string.Empty)
                            {
                                this.GetReport().SetParameterValue(inParameter, inParameterValue);
                            }
                            else
                            {
                                if (!mainParam.IsLinked())
                                    this.GetReport().SetParameterValue(inParameter, inParameterValue, mainParam.ReportName);
                            }
                        }
                    }
            }
            catch  {}
        }

The Result is that I get this failure from the CrystalReports viewer:

-


Crystal Report Windows Forms Viewer

-


Parameterfeld @intFKCustomer wurde in Unterbericht TestUnterbericht nicht gefunden.

-


OK

-


Parameterfeld @intFKCustomer wurde in Unterbericht TestUnterbericht nicht gefunden.

is German and means in English:

Can not find paramterfield @intFKCustomer in the Subreport "TestUnterbericht"