繁体   English   中英

Crystal Report未将参数传递给子报表

[英]Crystal Report not passing parameters to subreport

我有一个可配置的获胜表格应用程序,可以在其中设置将子报表插入主报表的次数,如下所示:

Config页面:(导入子报告的顺序)

SubRep1 SubRep1 SubRep1 SubRep3 SubRep3 SubRep2 SubRep2 SubRep2

因此,在主报告中,我将导入/插入3次子报表1、2次子报表2和3次子报表2。每个子报表都有一个参数,我通过代码设置了一个值,但是它仅出现在子报表的第一个实例上报告...

因此,像这样:

SubRep1(具有参数)SubRep1 SubRep1 SubRep3(具有参数)SubRep3 SubRep2(具有参数)SubRep2 SubRep2

问题是我需要为每个参数都有一个参数! 我的代码...

SetMainReportParameters(reportParameterList);

                for (int i = 0; i < rlc.ReportLayout.Count; i++)
                {
                    if (rlc.ReportLayout[i].SubreportName == "SectionReportTest1.rpt")
                    {
                        SetSectionOneReportParameters(reportParameterList);
                    }
                    if (rlc.ReportLayout[i].SubreportName == "SectionReportTest2.rpt")
                    {
                        SetSectionTwoReportParameters(reportParameterList);
                    }
                    if (rlc.ReportLayout[i].SubreportName == "SectionReportTest3.rpt")
                    {
                        SetSectionThreeReportParameters(reportParameterList);
                    }
                }

当过去...

//list of every parameter (main and subreports)
                foreach (var current in reportParameterList)
                {
                    if (string.IsNullOrEmpty(current.SubreportName))
                    {
                        document.SetParameterValue(current.Name, current.Value);
                    }
                    else
                    {
                        document.SetParameterValue(current.Name, current.Value, current.SubreportName);
                    }
                }

在主报表的*.rpt文件中,您需要在子报表和主报表之间添加链接,并在其中传递参数值。 在模板中子报表对象的上下文菜单中应该可用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM