API/CodeSamples/ViewsOnly.md
... ...
@@ -0,0 +1,61 @@
1
+#ViewsOnly
2
+
3
+[[_TOC_]]
4
+
5
+##About
6
+
7
+Gets or sets whether the data sources will include only views or will include both views and other sources such as tables and stored procedures. This etting should be used if you would like only Views to be visible on the Data Sources tab of the Report Designer. This will show the users all views stored on the target database.
8
+
9
+_**Note**: ViewsOnly will NOT work if you also use VisibleDataSources._
10
+
11
+Use cases:
12
+1) Tables and fields may have not very user-friendly names. Creating Views with user-friendly names can make the process of working with the database much easier.
13
+2) You may not want to allow users to work with tables in your database because they may contain sensitive information or consist of raw data useless for reports. Creating Views with proper data aggregation may help you to build better reports with relevant data.
14
+
15
+**Troubleshooting:**
16
+If you are getting a "No tables to select" message, check if there is at least one View in the connected database.
17
+
18
+##Global.asax (C♯)
19
+
20
+```csharp
21
+//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
22
+public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig
23
+{
24
+ // Configure settings
25
+ // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method
26
+ public static void InitializeReporting() {
27
+ //Check to see if we've already initialized.
28
+ if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null)
29
+ return;
30
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
31
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE";
32
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig();
33
+ AdHocSettings.ViewsOnly = true;
34
+ HttpContext.Current.Session["ReportingInitialized"] = true;
35
+ }
36
+}
37
+```
38
+
39
+##Global.asax (VB.NET)
40
+```visualbasic
41
+'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
42
+Public Class CustomAdHocConfig
43
+ Inherits Izenda.AdHoc.DatabaseAdHocConfig
44
+
45
+ Shared Sub InitializeReporting()
46
+ 'Check to see if we've already initialized
47
+ If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then
48
+ Return
49
+ 'Initialize System
50
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"
51
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"
52
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig()
53
+ AdHocSettings.ViewsOnly = True
54
+ HttpContext.Current.Session("ReportingInitialized") = True
55
+ End Sub
56
+End Class
57
+```
58
+
59
+##Screenshots
60
+
61
+![](http://www.izenda.com/Site/Images/Screenshots/ViewsOnlyDS.png)
... ...
\ No newline at end of file