The following example creates a table and assigns it to a report.
privatebool CreateReportTable() { // Get report object by report code name ReportInfo report = ReportInfoProvider.GetReportInfo("MyNewReport"); // If report exists if (report != null) { // Create new report table object ReportTableInfo newTable = newReportTableInfo(); // Set the properties newTable.TableDisplayName = "My new table"; newTable.TableName = "MyNewTable";
newTable.TableQuery = "SELECT TOP 10 DocumentName, DocumentID FROM CMS_Document";
newTable.TableReportID = report.ReportID; newTable.TableQueryIsStoredProcedure = false; // Save the report table ReportTableInfoProvider.SetReportTableInfo(newTable); returntrue; } returnfalse; }
The following example gets and updates a report table.
privatebool GetAndUpdateReportTable() {
// Get the report table ReportTableInfo updateTable = ReportTableInfoProvider.GetReportTableInfo("MyNewTable");
if (updateTable != null) { // Update the properties updateTable.TableDisplayName = updateTable.TableDisplayName.ToLower(); // Save the changes ReportTableInfoProvider.SetReportTableInfo(updateTable); returntrue; } returnfalse; }
The following example gets and bulk updates report tables.
privatebool GetAndBulkUpdateReportTables() { // Prepare the parameters string where = "TableName LIKE N'MyNewTable%'"; // Get the data DataSet tables = ReportTableInfoProvider.GetTables(where, null); if (!DataHelper.DataSourceIsEmpty(tables)) { // Loop through the individual items foreach (DataRow tableDr in tables.Tables[0].Rows) { // Create object from DataRow ReportTableInfo modifyTable = newReportTableInfo(tableDr); // Update the properties modifyTable.TableDisplayName = modifyTable.TableDisplayName.ToUpper(); // Save the changes ReportTableInfoProvider.SetReportTableInfo(modifyTable); } returntrue; } returnfalse; }
The following example deletes a report table.
privatebool DeleteReportTable() {
// Get the report table ReportTableInfo deleteTable = ReportTableInfoProvider.GetReportTableInfo("MyNewTable");
// Delete the report table ReportTableInfoProvider.DeleteReportTableInfo(deleteTable);