Microsoft Dynamics NAV Report Hacks
Working with reports in Dynamics NAV can be quite interesting and is actually intuitive, especially if you have a few report hacks, reminders, and ways to make things easier at your disposal.
Below are some of the aspects of report development that are often overlooked or forgotten. Without these reminders, working with reports in Dynamics NAV can be difficult and frustrating. Feel free to print this list out and keep it handy when working with reports.
Top Things to Keep in Mind when Working with Reports in Dynamics NAV
Filters for Integer loop: Imagine counting from -2,147,483,647 to 2,147,483,647. That is what happens when you run a report with Integer DataItem without filters. It is important to set filters for all the DataItems in the report. When you do not, you will end up with a report displaying items of irrelevant orders, incorrect customer balances, etc.
Scope: Have you ever come across a scenario in which aggregate functions like Sum give a gigantic value? It often happens in reports with multiple groups. A lifesaver here is the usage of Scope.
Angular Brackets for Dates: When you are developing a multi-language report, make sure that the date formulae are enclosed in angular brackets. If you do not, the formula 1W+1D in English may be converted to 1S+1J in French, which could be a big problem.
Also, do not forget to set language of the report as follows:
CurrReport.LANGUAGE := Language.GetLanguageID(“Language Code”)
Page Size: It is easy to forget about this property, which will result in blank pages/data cut off/ wrapping of data etc. if you do not set the page size.
Rectangle: It is quite common to see texts displayed in incorrect positions especially in Report Headers. This happens even when CanGrow and CanShrink property of the textbox is set to false. Here Rectangle comes to our rescue. Place textbox/textboxes inside a Rectangle and the problem is solved!
Number Formatting: You may wonder why numbers are not formatted even when you set the number format. One of the reasons could be that the textbox values may not have been converted to a numeric value. CInt or CDec function comes in handy to resolve this issue.
HTML: To allow html content in your report make sure you set Markup Type as HTML - Interpret tags as styles in Placeholder properties.
No Image: If your logo or image is missing in your report then there is a high chance that you missed using CALCFIELDS for the picture field.
Barcode: Use a Barcode scanner to verify if the barcode in your report is readable. Many a times you can see barcode displayed in the report but it will not be readable by the scanner.
Temporary: Make sure that you set the Temporary property for Buffer tables and Temporary variables to avoid deletion of any data.
Page Number: If you see continuous page numbers across the document, then it is time to check the ResetPageNumber property of the group.
Padding: Is the textbox content wrapping even after setting CanGrow and CanShrink property as False? If so, then adjust the size of text box or change the padding to avoid wrapping.
Report Header Size: If your report header is huge but you do not want it to occupy so much space in all the pages then you can just move the contents of report header to the report body.
Keys: Yes, it does matter in Reports too. You have to set a key for DataItem or use SETCURRENTKEY to avoid long running time of the reports.
Permissions: Set appropriate permissions for the report to use other objects otherwise the users may face errors while running the report.
HRESULT Error: It is a quite common error, which occurs while using Export to Excel. It could happen due to many reasons. One of the most common reasons is setting invalid Cell Type. So make sure that the datatype of a field and Cell Type are compatible.
Read more "How To" blogs from ArcherPoint for practical advice on using Microsoft Dynamics NAV. Check out our collection of NAV Development Blogs.