8042fd8653e1b50ce63c7f7a85ad68c7b6995a47
API/CodeSamples/ChartSortFields.md
| ... | ... | @@ -0,0 +1,64 @@ |
| 1 | +#ChartSortFields |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##About |
|
| 6 | + |
|
| 7 | +Gets or sets the list of additional columns that are used to sort chart data. This will apply only when using charts that have a separator value corresponding to one of the values in the array. The resulting chart will sort elements according to any sort already specified by the report designer plus the value of the separator column. The strings entered into the array should be the column name without the schema and table. |
|
| 8 | + |
|
| 9 | +_**Note:** The wildcard "*" denotes the list of existing sort items on the chart._ |
|
| 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 | + AdHocSettings.ChartSortFields = new string[] {"*", "ShipCountry"}; //The relevant setting |
|
| 27 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 28 | + } |
|
| 29 | +} |
|
| 30 | +``` |
|
| 31 | + |
|
| 32 | +##Global.asax (VB.NET) |
|
| 33 | + |
|
| 34 | +```visualbasic |
|
| 35 | +'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 36 | +Public Class CustomAdHocConfig |
|
| 37 | + Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 38 | + |
|
| 39 | + Shared Sub InitializeReporting() |
|
| 40 | + 'Check to see if we've already initialized |
|
| 41 | + If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then |
|
| 42 | + Return |
|
| 43 | + 'Initialize System |
|
| 44 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE" |
|
| 45 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE" |
|
| 46 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 47 | + AdHocSettings.ChartSortFields = New String() {"*", "ShipCountry"} 'The relevant setting |
|
| 48 | + HttpContext.Current.Session("ReportingInitialized") = True |
|
| 49 | + End Sub |
|
| 50 | +End Class |
|
| 51 | +``` |
|
| 52 | + |
|
| 53 | +##Screenshots |
|
| 54 | + |
|
| 55 | +A sample report definition. Note the chart separator value. |
|
| 56 | +![]() |
|
| 57 | + |
|
| 58 | +AdHocSettings.ChartSortFields = {"*", "ShipCountry"} |
|
| 59 | + |
|
| 60 | +![]() |
|
| 61 | + |
|
| 62 | +AdHocSettings.ChartSortFields = null |
|
| 63 | + |
|
| 64 | +![]() |
|
| ... | ... | \ No newline at end of file |