04779daf2b4b35ab5a8580d7e487daf8ff7041d6
API/CodeSamples/GetEqualsSelectValues.md
| ... | ... | @@ -0,0 +1,72 @@ |
| 1 | +#GetEqualsSelectValues |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##About |
|
| 6 | + |
|
| 7 | +_**Obsolete:** Use the ProcessEqualsSelectList override in the CustomAdHocConfig class instead._ |
|
| 8 | + |
|
| 9 | +Represents a method that returns values for the OperatorTypes.Equals_Select operator. |
|
| 10 | + |
|
| 11 | +**Default Value:** null |
|
| 12 | + |
|
| 13 | +##Global.asax (C♯) |
|
| 14 | + |
|
| 15 | +```csharp |
|
| 16 | +//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 17 | +public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 18 | +{ |
|
| 19 | + // Configure settings |
|
| 20 | + // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method |
|
| 21 | + public static void InitializeReporting() { |
|
| 22 | + //Check to see if we've already initialized. |
|
| 23 | + if (AdHocContext.Initialized) |
|
| 24 | + return; |
|
| 25 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 26 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 27 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 28 | + AdHocSettings.GetEqualsSelectValues = EqualsSelectDelegate; //The relevant setting |
|
| 29 | + AdHocContext.Initialized = true; |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + private static string[] EqualsSelectDelegate(Column column) |
|
| 33 | + { |
|
| 34 | + if (column.FullName.Contains("ShipCountry")) |
|
| 35 | + return new string[] { "USA", "UK", "Germany", "Japan", "China", "Brazil", "Canada" }; |
|
| 36 | + else |
|
| 37 | + return AdHocSettings.AdHocConfig.ProcessEqualsSelectList(column); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | +} |
|
| 41 | +``` |
|
| 42 | + |
|
| 43 | +##Global.asax (VB.NET) |
|
| 44 | + |
|
| 45 | +```visualbasic |
|
| 46 | + |
|
| 47 | +'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 48 | +Public Class CustomAdHocConfig |
|
| 49 | + Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 50 | + |
|
| 51 | + Shared Sub InitializeReporting() |
|
| 52 | + 'Check to see if we've already initialized |
|
| 53 | + If AdHocContext.Initialized Then |
|
| 54 | + Return |
|
| 55 | + 'Initialize System |
|
| 56 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE" |
|
| 57 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE" |
|
| 58 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 59 | + AdHocSettings.GetEqualsSelectValues = EqualsSelectDelegate 'The relevant setting |
|
| 60 | + AdHocContext.Initialized = True |
|
| 61 | + End Sub |
|
| 62 | + |
|
| 63 | + Private Function EqualsSelectDelegate(column As Column) As String() |
|
| 64 | + If column.FullName.Contains("ShipCountry") Then |
|
| 65 | + Return New String() {"USA", "UK", "Germany", "Japan", "China", "Brazil", "Canada"} |
|
| 66 | + Else |
|
| 67 | + Return AdHocSettings.AdHocConfig.ProcessEqualsSelectList(column) |
|
| 68 | + End If |
|
| 69 | + End Function |
|
| 70 | + |
|
| 71 | +End Class |
|
| 72 | +``` |
|
| ... | ... | \ No newline at end of file |