ced1fa048947415d4d352eefec4c15d72f726689
FAQ/Questions/Changing-Data-Precision.md
| ... | ... | @@ -8,7 +8,7 @@ How can I change default data precision setting? |
| 8 | 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 | 9 | |
| 10 | 10 | |
| 11 | - |
|
| 11 | + |
|
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | The hard-code default setting, DECIMAL(18,6) can be easily modified by adding below setting code to the Driver (within InitializeReporting() method) . |
| ... | ... | @@ -16,6 +16,11 @@ The hard-code default setting, DECIMAL(18,6) can be easily modified by adding be |
| 16 | 16 | ### Example) DECIMAL(18,6) (Default) to NUMERIC(22,8) |
| 17 | 17 | |
| 18 | 18 | ```csharp |
| 19 | + |
|
| 20 | +public class CustomAdHocConfig : FileSystemAdHocConfig { |
|
| 21 | + public static void InitializeReporting() { |
|
| 22 | +... |
|
| 23 | + |
|
| 19 | 24 | List<KeyValuePair<string, string>> typeOverrides = AdHocContext.Driver.NativeTypesOverrides; |
| 20 | 25 | for (int i = 0; i < typeOverrides.Count; i++) |
| 21 | 26 | if (typeOverrides[i].Key == "Decimal") |
| ... | ... | @@ -25,4 +30,7 @@ for (int i = 0; i < typeOverrides.Count; i++) |
| 25 | 30 | } |
| 26 | 31 | AdHocContext.Driver.NativeTypesOverrides = typeOverrides; |
| 27 | 32 | |
| 33 | + }// End of InitializeReporting. |
|
| 34 | +... |
|
| 35 | +} |
|
| 28 | 36 | ``` |