954f07ac02991ece60f6dbbea0c038189f8f1017
API/CodeSamples/AllowArchivedReportTableCreation.md
| ... | ... | @@ -0,0 +1,56 @@ |
| 1 | +#AllowArchivedReportTableCreation |
|
| 2 | + |
|
| 3 | +Gets or sets the value indicating whether it is allowed to create the database table that contains archived reports if there is no such table in the database. If set, AdHoc checks if table in database for keeping reportsets exists, and creates it if necessary. |
|
| 4 | +By default the name of this table is IzendaAdHocReports. |
|
| 5 | + |
|
| 6 | +Note: It is required to allow create new table if you use DatabaseAdHocConfig. [[Read more about storing reports|/FAQ/Storing-Reports]] |
|
| 7 | + |
|
| 8 | +Also see [[SavedReportsTable|API/CodeSamples/SavedReportsTable]] |
|
| 9 | + |
|
| 10 | +##Global.asax (C♯) |
|
| 11 | + |
|
| 12 | +```csharp |
|
| 13 | +//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 14 | +public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 15 | +{ |
|
| 16 | + // Configure settings |
|
| 17 | + // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method |
|
| 18 | + public static void InitializeReporting() { |
|
| 19 | + //Check to see if we've already initialized. |
|
| 20 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 21 | + return; |
|
| 22 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 23 | + //Creates a connection to Microsoft SQL Server |
|
| 24 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 25 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 26 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 27 | + } |
|
| 28 | + public override void ConfigureSettings() { |
|
| 29 | + AdHocSettings.AllowArchivedReportTableCreation = true; |
|
| 30 | + } |
|
| 31 | +} |
|
| 32 | +``` |
|
| 33 | + |
|
| 34 | +##Global.asax (VB.NET) |
|
| 35 | + |
|
| 36 | +```visualbasic |
|
| 37 | +'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 38 | +Public Class CustomAdHocConfig |
|
| 39 | + Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 40 | + |
|
| 41 | + Shared Sub InitializeReporting() |
|
| 42 | + 'Check to see if we've already initialized |
|
| 43 | + If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then |
|
| 44 | + Return |
|
| 45 | + 'Initialize System |
|
| 46 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE" |
|
| 47 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE" |
|
| 48 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 49 | + HttpContext.Current.Session("ReortingInitialized") = True |
|
| 50 | + End Sub |
|
| 51 | + |
|
| 52 | + Public Overrides Sub ConfigureSettings() |
|
| 53 | + AdHocSettings.AllowArchivedReportTableCreation = True |
|
| 54 | + End Sub |
|
| 55 | +End Class |
|
| 56 | +``` |
|
| ... | ... | \ No newline at end of file |