9da7d5c7027ec44025ac63a930b45f2daf1c071f
API/CodeSamples/VisibleDataSources.md
| ... | ... | @@ -0,0 +1,52 @@ |
| 1 | +#VisibleDataSources |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +Gets or sets the array of names for tables and views that should be shown in the "Data Sources (Tables and Views)" dropdown in the ReportDesigner on the Data Sources tab. |
|
| 6 | + |
|
| 7 | +##Global.asax (C♯) |
|
| 8 | +```csharp |
|
| 9 | +//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 10 | +public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 11 | +{ |
|
| 12 | + // Configure settings |
|
| 13 | + // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method |
|
| 14 | + public static void InitializeReporting() { |
|
| 15 | + //Check to see if we've already initialized. |
|
| 16 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 17 | + return; |
|
| 18 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 19 | + //Creates a connection to Microsoft SQL Server |
|
| 20 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 21 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 22 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 23 | + } |
|
| 24 | + public override void ConfigureSettings() { |
|
| 25 | + AdHocSettings.VisibleDataSources = new string[] {"DataSource1", "DataSource2"}; |
|
| 26 | + } |
|
| 27 | +} |
|
| 28 | +``` |
|
| 29 | + |
|
| 30 | +##Global.asax (VB.NET) |
|
| 31 | + |
|
| 32 | +```visualbasic |
|
| 33 | +'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 34 | +Public Class CustomAdHocConfig |
|
| 35 | + Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 36 | + |
|
| 37 | + Shared Sub InitializeReporting() |
|
| 38 | + 'Check to see if we've already initialized |
|
| 39 | + If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then |
|
| 40 | + Return |
|
| 41 | + 'Initialize System |
|
| 42 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE" |
|
| 43 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE" |
|
| 44 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 45 | + HttpContext.Current.Session("ReortingInitialized") = True |
|
| 46 | + End Sub |
|
| 47 | + |
|
| 48 | + Public Overrides Sub ConfigureSettings() |
|
| 49 | + AdHocSettings.VisibleDataSources = New String() {"Datasource1", "Datasource2"} |
|
| 50 | + End Sub |
|
| 51 | +End Class |
|
| 52 | +``` |
|
| ... | ... | \ No newline at end of file |