API/CodeSamples/AllowComparativeArithmetic.md
... ...
@@ -0,0 +1,61 @@
1
+#AllowComparativeArithmetic
2
+
3
+[[_TOC_]]
4
+
5
+##About
6
+
7
+Gets or sets the value indicating whether comparative arithmetic is allowed in arithmetic checkbox. Logical comparisons (less than and greater than) can be used between the preceding field and the selected field when cycling through values on the "A" checkbox of the report designer. Certain datatypes behave differently when this is enabled.
8
+
9
+##Global.asax (C♯)
10
+
11
+```csharp
12
+//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
13
+public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig
14
+{
15
+ // Configure settings
16
+ // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method
17
+ public static void InitializeReporting() {
18
+ //Check to see if we've already initialized.
19
+ if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null)
20
+ return;
21
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
22
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE";
23
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig();
24
+ AdHocSettings.AllowComparativeArithmetic = true;
25
+ HttpContext.Current.Session["ReportingInitialized"] = true;
26
+ }
27
+}
28
+```
29
+
30
+##Global.asax (VB.NET)
31
+
32
+```visualbasic
33
+'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
34
+Public Class CustomAdHocConfig
35
+ Inherits Izenda.AdHoc.DatabaseAdHocConfig
36
+
37
+ 'Configure settings
38
+ 'Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method
39
+ Shared Sub InitializeReporting()
40
+ 'Check to see if we've already initialized.
41
+ If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then
42
+ Return
43
+ 'Initialize System
44
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"
45
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"
46
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig()
47
+ AdHocSettings.AllowComparativeArithmetic = True
48
+ HttpContext.Current.Session("ReportingInitialized") = True
49
+ End Sub
50
+End Class
51
+```
52
+
53
+##Screenshots (Report Designer)
54
+
55
+Field "Quantity" compared to field "ExtendedPrice" with alias "Sales"
56
+
57
+![]()
58
+
59
+Provided "Average" is selected, this will generate SQL like the following:
60
+CASE WHEN ([dbo].[Invoices].[ExtendedPrice]<AVG(CAST([dbo].[Invoices].[Quantity] AS float))) THEN 1 ELSE 0 END AS 'Sales'
61
+