API/CodeSamples/ExtendedFunctions.md
... ...
@@ -0,0 +1,53 @@
1
+#ExtendedFunctions
2
+
3
+This list allows the user specify additional SQL functions that should be included in the functions dropdown of the Fields tab. [[Learn more about UDFs|/FAQ/izenda-and-udfs]] (User Defined Functions).
4
+
5
+Below is a sample global.asax using the ExtendedFunctions setting. The code block will appear within ``<script runat="server"> </script>`` tags within global.asax.
6
+
7
+##Global.asax (C♯)
8
+
9
+```csharp
10
+//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
11
+public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig
12
+{
13
+ // Configure settings
14
+ // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method
15
+ public static void InitializeReporting() {
16
+ //Check to see if we've already initialized.
17
+ if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null)
18
+ return;
19
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
20
+ //Creates a connection to Microsoft SQL Server
21
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE";
22
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig();
23
+ HttpContext.Current.Session["ReportingInitialized"] = true;
24
+ }
25
+ public override void ConfigureSettings() {
26
+ AdHocSettings.ExtendedFunctions = new string[] { "[dbo].[SafeDivide]" };
27
+ }
28
+}
29
+```
30
+
31
+##Global.asax (VB.NET)
32
+
33
+```visualbasic
34
+'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
35
+Public Class CustomAdHocConfig
36
+ Inherits Izenda.AdHoc.DatabaseAdHocConfig
37
+
38
+ Shared Sub InitializeReporting()
39
+ 'Check to see if we've already initialized
40
+ If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then
41
+ Return
42
+ 'Initialize System
43
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"
44
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"
45
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig()
46
+ HttpContext.Current.Session("ReortingInitialized") = True
47
+ End Sub
48
+
49
+ Public Overrides Sub ConfigureSettings()
50
+ AdHocSettings.ExtendedFunctions = New String() { "[dbo].[SafeDivide]" }
51
+ End Sub
52
+End Class
53
+```
... ...
\ No newline at end of file