FAQ/Questions/Custom-Aggregate-Functions.md
... ...
@@ -112,4 +112,94 @@ public class GroupByFiscalYearFunction : IAggregateFunction {
112 112
this.isGroup = true;
113 113
}
114 114
}
115
-```
... ...
\ No newline at end of file
0
+```
1
+
2
+```visualbasic
3
+Public Class GroupByFiscalYearFunction
4
+ Implements IAggregateFunction
5
+ Public Function GetSQL(ByVal innerExpression As String, ByVal type As SqlType) As String Implements IAggregateFunction.GetSQL
6
+ 'returns the portion of the GROUP BY clause just after the GROUP BY keyword And wraps around the respective field selected in the fields dropdown list.
7
+ Return String.Format("DATEPART(yyyy, DATEADD(mm, 3, {0}))", innerExpression)
8
+ End Function
9
+
10
+ Private _caption As String
11
+ Public ReadOnly Property Caption As String Implements IAggregateFunction.Caption
12
+ Get
13
+ Return _caption
14
+ End Get
15
+ End Property
16
+ Private _allowedTypeGroups As Hashtable = Nothing
17
+ Public ReadOnly Property AllowedTypeGroups As Hashtable Implements IAggregateFunction.AllowedTypeGroups
18
+ Get
19
+ Return _allowedTypeGroups
20
+ End Get
21
+ End Property
22
+
23
+ Private _disallowedTypeGroups As Hashtable = Nothing
24
+ Public ReadOnly Property DisallowedTypeGroups As Hashtable Implements IAggregateFunction.DisallowedTypeGroups
25
+ Get
26
+ Return _disallowedTypeGroups
27
+ End Get
28
+ End Property
29
+
30
+ Private _isScalar As Boolean
31
+ Public Property IsScalar As Boolean Implements IAggregateFunction.IsScalar
32
+ Get
33
+ Return _isScalar
34
+ End Get
35
+ Set
36
+ _isScalar = Value
37
+ End Set
38
+ End Property
39
+
40
+ Private _isGroup As Boolean
41
+ Public ReadOnly Property IsGroup As Boolean Implements IAggregateFunction.IsGroup
42
+ Get
43
+ Return _isGroup
44
+ End Get
45
+ End Property
46
+
47
+ Public Function CompatibilityWithFunction(ByVal isExtraFunction As Boolean) As Boolean Implements IAggregateFunction.CompatibilityWithFunction
48
+ Return True
49
+ End Function
50
+
51
+ Private _outputType As SqlType = SqlType.Unknown
52
+ Public Property OutputType As SqlType Implements IAggregateFunction.OutputType
53
+ Get
54
+ Return _outputType
55
+ End Get
56
+ Set
57
+ _outputType = Value
58
+ End Set
59
+ End Property
60
+
61
+ Private _isExtraFunction As Boolean = False
62
+ Public ReadOnly Property IsExtraFunction As Boolean Implements IAggregateFunction.IsExtraFunction
63
+ Get
64
+ Return _isExtraFunction
65
+ End Get
66
+ End Property
67
+
68
+ Public ReadOnly Property Formatters() As IFormatter() Implements IAggregateFunction.Formatters
69
+ Get
70
+ Return New IFormatter(0) {}
71
+ End Get
72
+ End Property
73
+
74
+ Public Sub New()
75
+ Me._caption = "Group (Fiscal Year)"
76
+
77
+ Me._allowedTypeGroups = New Hashtable(2)
78
+ Me._allowedTypeGroups.Add(SqlTypeGroup.DateTime, True)
79
+ Me._allowedTypeGroups.Add(SqlTypeGroup.Date, True)
80
+
81
+ Me._isGroup = True
82
+ End Sub
83
+End Class
84
+```
85
+
86
+##Screenshots
87
+
88
+![](/FAQ/Questions/Custom-Aggregate-Functions/group_by_fiscal_year_2_1.png)
89
+
90
+![](/FAQ/Questions/Custom-Aggregate-Functions/group_by_fiscal_year_2_results.png)
... ...
\ No newline at end of file