6b4726cd9c0cefc0c3f97e8b46536265d48ae5b0
API/CodeSamples/AllowSelfJoin.md
| ... | ... | @@ -0,0 +1,50 @@ |
| 1 | +#AllowSelfJoin |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##About |
|
| 6 | + |
|
| 7 | +Gets or sets the value indicating whether self-joining tables is allowed in reports. If this is true and [[ShowDataSourcesAsCheckBoxes|/API/CodeSamples/ShowDataSourcesAsCheckboxes]] is also true, then the user can select the same data source twice to self-join it at the Data Sources tab in the ReportDesigner. This can be useful when you need to pick data from a single table where one value is equal to another. |
|
| 8 | + |
|
| 9 | +##Global.asax (C♯) |
|
| 10 | + |
|
| 11 | +```csharp |
|
| 12 | +//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 13 | +public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 14 | +{ |
|
| 15 | + // Configure settings |
|
| 16 | + // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method |
|
| 17 | + public static void InitializeReporting() { |
|
| 18 | + //Check to see if we've already initialized. |
|
| 19 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 20 | + return; |
|
| 21 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 22 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 23 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 24 | + AdHocSettings.AllowSelfJoin = true; //The relevant setting |
|
| 25 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 26 | + } |
|
| 27 | +} |
|
| 28 | +``` |
|
| 29 | + |
|
| 30 | +##Global.asax (VB.NET) |
|
| 31 | + |
|
| 32 | +```visualbasic |
|
| 33 | + |
|
| 34 | +'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 35 | +Public Class CustomAdHocConfig |
|
| 36 | + Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 37 | + |
|
| 38 | + Shared Sub InitializeReporting() |
|
| 39 | + 'Check to see if we've already initialized |
|
| 40 | + If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then |
|
| 41 | + Return |
|
| 42 | + 'Initialize System |
|
| 43 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE" |
|
| 44 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE" |
|
| 45 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 46 | + AdHocSettings.AllowSelfJoin = True 'The relevant setting |
|
| 47 | + HttpContext.Current.Session("ReportingInitialized") = True |
|
| 48 | + End Sub |
|
| 49 | +End Class |
|
| 50 | +``` |
|
| ... | ... | \ No newline at end of file |