The following sample code shows how you can create a new graph under an existing report:
[C#]
using CMS.Reporting;
...
// Get report object by report code name ReportInfo ri = ReportInfoProvider.GetReportInfo("TestReport");
// If report exists if (ri != null) { // Create new graph object ReportGraphInfo rgi = new ReportGraphInfo();
// Set properties rgi.GraphDisplayName = "Test graph"; rgi.GraphName = "TestGraph"; rgi.GraphQuery = "SELECT TOP 10 DocumentName, DocumentID FROM CMS_Document"; rgi.GraphReportID = ri.ReportID; rgi.GraphQueryIsStoredProcedure = false;
rgi.GraphType = "bar";
// Save to database ReportGraphInfoProvider.SetReportGraphInfo(rgi);
} |
The following sample code shows how you can create a new table under an existing report:
[C#]
using CMS.Reporting;
...
// Get report object by report code name ReportInfo ri = ReportInfoProvider.GetReportInfo("TestReport");
// If report exists if (ri != null) { // Create new table object ReportTableInfo rti = new ReportTableInfo();
// Set properties rti.TableDisplayName = "Test table"; rti.TableName = "TestTable"; rti.TableQuery = "SELECT TOP 10 DocumentName, DocumentID FROM CMS_Document"; rti.TableReportID = ri.ReportID; rti.TableQueryIsStoredProcedure = false;
// Save to database ReportTableInfoProvider.SetReportTableInfo(rti);
} |
The following sample code shows how you can create a new value under an existing report:
[C#]
using CMS.Reporting;
...
// Get report object by report code name ReportInfo ri = ReportInfoProvider.GetReportInfo("TestReport");
// If report exists if (ri != null) { // Create new value object ReportValueInfo rvi = new ReportValueInfo();
// Set properties rvi.ValueDisplayName = "Test value"; rvi.ValueName = "TestValue"; rvi.ValueQuery = "SELECT COUNT(DocumentName) FROM CMS_Document"; rvi.ValueReportID = ri.ReportID; rvi.ValueQueryIsStoredProcedure = false;
// Save to database ReportValueInfoProvider.SetReportValueInfo(rvi);
} |