2016-08-29 10 views
0

をサブレポートにパラメータを渡すではない私は、設定可能な勝利は、私は、サブレポートは、このようなメインレポートの中に挿入することができますどのくらいの時間を設定可能なアプリを形成します:Crystalレポート

コンフィグページ:(サブレポートをインポートするため)

SubRep1 SubRep1 SubRep1 SubRep3 SubRep3 SubRep2 SubRep2 SubRep2

だから、私のメインレポートでは、私は/ inseをインポートしますrt 3回のサブレポート1,2回のサブレポート2と3回のサブレポート2各サブレポートには1つのパラメータがあり、コードを使って値を設定しますが、レポートの最初のインスタンスにのみ表示されます...

したがって、このように:

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); 
        } 
       } 

と渡して...あなたはサブレポートとメインレポート間のリンクを追加して、パラメータを渡す必要があるメインレポートの*.rptファイルで

//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); 
        } 
       } 

答えて

0

そこの値。テンプレート内のサブレポートオブジェクトのコンテキストメニューで使用できるようにする必要があります。