FAQ/Questions/Storing-Custom-Constraints.md
... ...
@@ -0,0 +1,36 @@
1
+##Question
2
+
3
+How can I change default data precision setting?
4
+
5
+
6
+##Answer
7
+
8
+When Izenda loads a report that uses a stored procedure, it creates a temporary table to store the values. For string, it creates NVARCHAR(MAX) columns and for numeric fields a DECIMAL(18,6). Therefore, if any field with greater precision such as NUMERIC(22,8) is used, the report then fails with a conversion error as below because it cannot fit the NUMERIC(22,8) value into a DECIMAL(18,6) column.
9
+
10
+
11
+![Conversion Error](/Home/Conversion.JPG)
12
+
13
+
14
+The hard-code default setting, DECIMAL(18,6) can be easily modified by adding below setting code to the Driver (within InitializeReporting() method) .
15
+
16
+### Example) DECIMAL(18,6) (Default) to NUMERIC(22,8)
17
+
18
+```csharp
19
+
20
+public class CustomAdHocConfig : FileSystemAdHocConfig {
21
+ public static void InitializeReporting() {
22
+...
23
+
24
+List<KeyValuePair<string, string>> typeOverrides = AdHocContext.Driver.NativeTypesOverrides;
25
+for (int i = 0; i < typeOverrides.Count; i++)
26
+ if (typeOverrides[i].Key == "Decimal")
27
+ {
28
+ typeOverrides[i] = new KeyValuePair<string, string>(typeOverrides[i].Key, "NUMERIC(22,8)");
29
+ break;
30
+ }
31
+AdHocContext.Driver.NativeTypesOverrides = typeOverrides;
32
+
33
+ }// End of InitializeReporting.
34
+...
35
+}
36
+```