97bc618734956a082bc3a6f4ae9502b3c2676f91
API/AdhocSettings/AllowCreateNewCategory.md
| ... | ... | @@ -0,0 +1,65 @@ |
| 1 | +#AllowCreateNewCategory |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##About |
|
| 6 | +**Data Type:** Bool |
|
| 7 | +**Accepted Values:** true,false,1,0 |
|
| 8 | +**Default value:** true |
|
| 9 | +**Impacted Features:** Report Design, Dashboard Design, Report List |
|
| 10 | +**Purpose:** Removes the "New Category" option from the initial Save and Save As dialogue box. |
|
| 11 | +**Usage:** This setting is used to disable new categories from being created by users. It can be set per user through security. |
|
| 12 | +**Caveats:** If [[HiddenCategories|/API/CodeSamples/HiddenCategories]] are used for the current user and this setting is true, the user will be able to "create" a category with the same name as the hidden category and save reports to it, but these reports will be invisible once the user navigates back to the report list. |
|
| 13 | + |
|
| 14 | +##Code Samples |
|
| 15 | +###Global.asax (C♯) |
|
| 16 | + |
|
| 17 | +```csharp |
|
| 18 | +//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 19 | +public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 20 | +{ |
|
| 21 | + // Configure settings |
|
| 22 | + // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method |
|
| 23 | + public static void InitializeReporting() { |
|
| 24 | + //Check to see if we've already initialized. |
|
| 25 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 26 | + return; |
|
| 27 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 28 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 29 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 30 | + AdHocSettings.HeaderStyle = ""; //The relevant setting |
|
| 31 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 32 | + } |
|
| 33 | +} |
|
| 34 | +``` |
|
| 35 | + |
|
| 36 | +###Global.asax (VB.NET) |
|
| 37 | + |
|
| 38 | +```visualbasic |
|
| 39 | +'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 40 | +Public Class CustomAdHocConfig |
|
| 41 | + Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 42 | + |
|
| 43 | + Shared Sub InitializeReporting() |
|
| 44 | + 'Check to see if we've already initialized |
|
| 45 | + If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then |
|
| 46 | + Return |
|
| 47 | + 'Initialize System |
|
| 48 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE" |
|
| 49 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE" |
|
| 50 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 51 | + AdHocSettings.HeaderStyle = "" 'The relevant setting |
|
| 52 | + HttpContext.Current.Session("ReportingInitialized") = True |
|
| 53 | + End Sub |
|
| 54 | +End Class |
|
| 55 | +``` |
|
| 56 | + |
|
| 57 | +##Screenshots |
|
| 58 | + |
|
| 59 | +AdHocSettings.AllowCreateNewCategory = true; |
|
| 60 | + |
|
| 61 | + |
|
| 62 | + |
|
| 63 | +AdHocSettings.AllowCreateNewCategory = false; |
|
| 64 | + |
|
| 65 | + |