FAQ/izenda-and-udfs.md
... ...
@@ -0,0 +1,38 @@
1
+#Izenda and UDFs (User Defined Functions)
2
+
3
+## How do I utilize a complex UDF from my database within Izenda?
4
+
5
+**1) Create UDF in the DB that performs your calculation:**
6
+
7
+**EXAMPLE UDF:**
8
+
9
+**MsSQL**
10
+```sql
11
+CREATE FUNCTION [dbo].[SafeDivide] (@p1 real ,@p2 real )
12
+RETURNS real
13
+AS
14
+BEGIN
15
+ RETURN ISNULL(@p1 / NULLIF(@p2, 0), 0)
16
+END
17
+```
18
+
19
+**Oracle**
20
+```sql
21
+create or replace function "SAFEDIVIDE"
22
+(p1 in NUMBER, p2 in NUMBER)
23
+return NUMBER
24
+as
25
+begin
26
+ RETURN ROUND(nvl(p1 / NULLIF(p2, 0), 0), 7);
27
+end;
28
+```
29
+
30
+**2) Add this function to Izenda:**
31
+``AdHocSettings.ExtendedFunctions = new string[] { "[dbo].[SafeDivide]" };``
32
+
33
+**3a) You can now choose this function in the 'Fields' tab function drop down for any column. (Functions, as the one above, with more than one input parameter cannot be chosen for a single column in the functions drop-down and must be implemented as an expression)**
34
+
35
+<font color="red">Add Picture</font>
36
+
37
+**3b) You can also use this function in the 'Fields' tab [[advanced panel|http://wiki.izenda.us/FAQ/advanced-field-settings]] - Expression:**
38
+``SafeDivide(SUM([LaborCost]),SUM([SoldHours]))``
... ...
\ No newline at end of file
izenda-and-udfs.md
... ...
@@ -1,38 +0,0 @@
1
-#Izenda and UDFs (User Defined Functions)
2
-
3
-## How do I utilize a complex UDF from my database within Izenda?
4
-
5
-**1) Create UDF in the DB that performs your calculation:**
6
-
7
-**EXAMPLE UDF:**
8
-
9
-**MsSQL**
10
-```sql
11
-CREATE FUNCTION [dbo].[SafeDivide] (@p1 real ,@p2 real )
12
-RETURNS real
13
-AS
14
-BEGIN
15
- RETURN ISNULL(@p1 / NULLIF(@p2, 0), 0)
16
-END
17
-```
18
-
19
-**Oracle**
20
-```sql
21
-create or replace function "SAFEDIVIDE"
22
-(p1 in NUMBER, p2 in NUMBER)
23
-return NUMBER
24
-as
25
-begin
26
- RETURN ROUND(nvl(p1 / NULLIF(p2, 0), 0), 7);
27
-end;
28
-```
29
-
30
-**2) Add this function to Izenda:**
31
-``AdHocSettings.ExtendedFunctions = new string[] { "[dbo].[SafeDivide]" };``
32
-
33
-**3a) You can now choose this function in the 'Fields' tab function drop down for any column. (Functions, as the one above, with more than one input parameter cannot be chosen for a single column in the functions drop-down and must be implemented as an expression)**
34
-
35
-<font color="red">Add Picture</font>
36
-
37
-**3b) You can also use this function in the 'Fields' tab [[advanced panel|http://wiki.izenda.us/FAQ/advanced-field-settings]] - Expression:**
38
-``SafeDivide(SUM([LaborCost]),SUM([SoldHours]))``
... ...
\ No newline at end of file