Kentico CMS 7.0 Developer's Guide

Adding elements to the layout of a report

Adding elements to the layout of a report

Previous topic Next topic Mail us feedback on this topic!  

Adding elements to the layout of a report

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

Arrow


API examples for newer versions


Please visit the latest API Examples documentation to view API examples for newer versions of Kentico.



The following example inserts elements into the layout of a report.

 

private bool InsertElementsToLayout()
{
    // Get report object by report code name
    ReportInfo report = ReportInfoProvider.GetReportInfo("MyNewReport");
 
    // If report exists
    if (report != null)
    {

      ReportGraphInfo graph = ReportGraphInfoProvider.GetReportGraphInfo("MyNewGraph");

        if (graph != null)
        {

           report.ReportLayout += "<br/>%%control:Report" + ReportItemType.Graph + "?" + report.ReportName + "." + graph.GraphName + "%%<br/>";

        }

 
      ReportTableInfo table = ReportTableInfoProvider.GetReportTableInfo("MyNewTable");

        if (table != null)
        {

           report.ReportLayout += "<br/>%%control:Report" + ReportItemType.Table + "?" + report.ReportName + "." + table.TableName + "%%<br/>";

        }

 
      ReportValueInfo value = ReportValueInfoProvider.GetReportValueInfo("MyNewValue");

        if (value != null)
        {

           report.ReportLayout += "<br/>%%control:Report" + ReportItemType.Value + "?" + report.ReportName + "." + value.ValueName + "%%<br/>";

        }
 
        ReportInfoProvider.SetReportInfo(report);
 
        return true;
    }
 
    return false;
}