I have seen several reports about the Microsoft Dynamics NAV RDLC reports dropping symbols out of decimals when printing out a report. One of the most common occurrences, that I have seen, is when the de-CH locale is being used by the end user. After some investigation, it appears that this problem is due to some changes between Windows 7 and Windows 8 (and Windows 2012).
Windows 7 (de-CH): 1’745.55
Windows 8 (de-CH): 1 745.55 [Note: the thousand separator is not printed]
During my investigation I found some references to using “Custom Locales” to resolve this issue. In order to use a custom locale you must build a replacement locale using the Locale Builder 2.0 tool. There is a link to this tool at the following referenced URL. Once this is created, you then need to replace your existing locale. If you are interested in more information, please follow this link (http://msdn.microsoft.com/en-us/library/windows/desktop/dd317785(v=vs.85).aspx ).
Another option ...
There is another way that doesn’t involved changing out your locale. All it takes is a little code and some familiarity with editing RDLC reports. For this blog I am going to use Microsoft Visual Studio 2012 and Microsoft Dynamics NAV 2013 R2. I have outlined the required steps below …
1) After designing a report in the Microsoft Dynamics NAV 2013 R2 development environment, load the RDLC Layout (View\Layout). Depending on your setup, this will either load Microsoft Visual Studio 2012 or Report Builder 3.0 (if you are using Microsoft SQL Server 2012).
2) Once the layout is open, display the properties of the report. This can be done by opening the Properties window (CTRL+W,P) and clicking in the blank area around the Report or right click in the blank area around the report and select Report Properties.
3) You should see a Properties window like this …
4) Scroll to the bottom of the existing code functions and add the following code …
Public Function FormatDecimalString(ByVal Amount as Decimal, ByVal FormatString as String,ByVal Language as String) as String
Dim CultureInfo as New System.Globalization.CultureInfo(Language)
The new function will convert a decimal amount to a specific cultural locale based on the format string provided in the dataset.
5) Next, select a textbox that needs to have its printed format corrected. Once the textbox has its border highlighted, right click and select the Expression option. This will open the Expressions window.
6) Now, copy the following code into the “Set expression for: Value” textbox. The following code will need to replace the reference to the current value.
Make sure to replace <FIELDNAME.VALUE> with the appropriate value reference and replace <FIELDNAMEFORMAT.VALUE> with the appropriate format reference. This code will replace the comma in the en-US format with an apostrophe to match the de-CH format.
For Example: If you use the GLBalance field from the Dataset of REPORT 4 – Detail Trial Balance, then the code would look like this …
When using the de-CH locale, the number format is similar to what en-US uses, except that the apostrophe in the de-CH format is replaced with the comma in the en-US format.
de-CH 1’745.55 ==> en-US 1,745.55
The basic premise behind these code changes is to convert the decimal value to a locale format that is then returned as a text. Once in the text format, it is now possible to replace the values for the thousands and decimal separators as needed.
Hopefully, this will make your reporting experience in Microsoft Dynamics NAV 2013 R2 a little easier.
These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.