59416ba03f33f09a645762fde352acffcc2a7630
API/CodeSamples/VisibleDataSources.md
| ... | ... | @@ -2,11 +2,18 @@ |
| 2 | 2 | |
| 3 | 3 | [[_TOC_]] |
| 4 | 4 | |
| 5 | -Gets or sets the array of names for tables and views that should be shown in the "Data Sources (Tables and Views)" dropdown in the ReportDesigner on the Data Sources tab. Setting any values in this list will completely override the normally constructed list of tables and views on a per-user basis. Additionally, any reports that use a datasource that is hidden from the current user will not be available for a user to access. |
|
| 5 | +##About |
|
| 6 | +**Data Type:** string[] |
|
| 7 | +**Accepted Values:** Table, view and stored procedure names |
|
| 8 | +**Default value:** Empty array |
|
| 9 | +**Impacted Features:** Report Design, Report List |
|
| 10 | +**Purpose:** Gets or sets the array of names for tables and views that should be shown in the "Data Sources (Tables and Views)" drop-down in the Report Designer on the Data Sources tab. |
|
| 11 | +**Usage:** This setting is used to make stored procedures appear in Izenda. It is also used to limit what data sources each user has access to for security reasons. |
|
| 12 | +**Caveats:** Setting any values in this list will completely override the normally constructed list of tables and views on a per-user basis. Additionally, any reports that use a data source that is hidden from the current user will not be available for a user to access. |
|
| 6 | 13 | |
| 7 | -**Default Value:** System.String[] {} |
|
| 14 | +##Code Samples |
|
| 15 | +###Global.asax (C♯) |
|
| 8 | 16 | |
| 9 | -##Global.asax (C♯) |
|
| 10 | 17 | ```csharp |
| 11 | 18 | //main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
| 12 | 19 | public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
| ... | ... | @@ -27,7 +34,7 @@ public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
| 27 | 34 | } |
| 28 | 35 | ``` |
| 29 | 36 | |
| 30 | -##Global.asax (VB.NET) |
|
| 37 | +###Global.asax (VB.NET) |
|
| 31 | 38 | |
| 32 | 39 | ```visualbasic |
| 33 | 40 | 'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
| ... | ... | @@ -48,8 +55,21 @@ Public Class CustomAdHocConfig |
| 48 | 55 | End Class |
| 49 | 56 | ``` |
| 50 | 57 | |
| 58 | +##Alternate Usage |
|
| 59 | + |
|
| 60 | +If you would like for all tables, views and stored procedures to be shown, use the following snippet. |
|
| 61 | + |
|
| 62 | +```csharp |
|
| 63 | +//setting vis datasources |
|
| 64 | +DataSet ds = AdHocContext.Driver.GetDataSet(AdHocContext.Driver.CreateCommand("select * from sys.objects where type in ('U','P','V')")); |
|
| 65 | +string[] results = new string[ds.Tables[0].Rows.Count]; |
|
| 66 | +for (int i = 0; i < ds.Tables[0].Rows.Count; i++) |
|
| 67 | +results[i] = ds.Tables[0].Rows[i][0].ToString(); |
|
| 68 | +AdHocSettings.VisibleDataSources = results; |
|
| 69 | +``` |
|
| 70 | + |
|
| 51 | 71 | ##Screenshots |
| 52 | 72 | |
| 53 | 73 | **AdHocSettings.VisibleDataSources = new string[] { "Products", "Orders", "Customers" };** |
| 54 | 74 | |
| 55 | -![VisibleDataSources = new string[] {"Products", "Orders", "Customers" };](/API/CodeSamples/VisibleDataSources/VisibleDataSources.png) |
|
| ... | ... | \ No newline at end of file |
| 0 | +![VisibleDataSources = new string[] {"Products", "Orders", "Customers" };](/API/CodeSamples/VisibleDataSources/VisibleDataSources.png) |