Hello everyone!
I hope you all are doing well. This is the second installment in our report development series. If you haven’t already watched the first video, which covers the basics of report components, I recommend checking out the playlist to get a foundational understanding before diving into this guide.
In today’s post, we’ll take a step forward and start building a document report, specifically a Sales Order Report. While working on this report, we’ll cover many essential aspects of RDLC report development that are crucial to understanding the overall process. This guide will focus on printing the report body, and in future posts, we’ll tackle the header and footer.
Step 1: Setting Up the Data Source
Since the sales line details in the report come from the Sales Line table, we need to create a new report using this table as the data source.
Open the Developer Environment in Dynamics NAV.
Create a new report and set the DataItem as
Sales Line
.Save the report with an ID, such as 60000, and name it
My Custom Sales Order Report
.Select the necessary fields from the
Sales Line
table that we want to display in the report output:Type
(Item, G/L Account, etc.)No.
(Number associated with the item)Description
Unit of Measure
Quantity
Line Amount
If any field isn’t directly selectable, you can manually append it in the dataset.
Ensure that each field has a valid name format (no spaces allowed) and then save the report.
Step 2: Understanding the Dataset
Before diving into the visual layout, it’s important to understand the dataset that the report generates.
Run the report preview.
Navigate to Help > About This Page to inspect the dataset structure.
Verify that the dataset includes all the required fields and understand how data is structured before designing the layout.
This dataset will serve as the foundation of our report and understanding it will help us troubleshoot issues as we progress.
Step 3: Designing the Report Layout
Now that our dataset is ready, let’s move to the layout design using either Visual Studio or Report Builder.
Open the report layout in the preferred tool.
Identify the Body section where the report details will be displayed.
Insert a Table Control to represent the sales lines.
Link the table to the dataset by setting the DataSetName property.
Add six columns to match the selected fields:
Type
No.
Description
Unit of Measure
Quantity
Line Amount
Format the table:
Ensure that the header row appears in bold.
Adjust column widths appropriately, especially for
Description
.Remove unnecessary default table borders for a cleaner look.
Add a bottom border for the header row to visually separate it from the data.
Step 4: Refining Report Formatting
Upon previewing the report, we might encounter formatting issues such as text wrapping and misaligned headers. Let’s refine the layout further:
Fix Multiline Text Issues:
Go to the properties of each column.
Set
CanGrow = False
to prevent text from expanding beyond cell boundaries.
Ensure Consistent Font and Style:
Set the font family to
Segoe UI
(standard in NAV reports).Adjust the font size to
8pt
for better readability.
Adjust Row Heights:
Standard NAV reports typically use a row height of
5 cm
. Ensure that the same applies to both the data and header rows.
Step 5: Preview and Final Adjustments
Now, let’s preview the report:
Run the report again to check the output.
Verify that columns are properly aligned, headers are bold, and there are no unwanted borders.
Ensure that numeric fields like
Line Amount
are formatted correctly.If needed, make final adjustments to column widths and alignments.
What’s Next?
In the next post, we’ll explore header and footer design options in Dynamics NAV, including:
Fixed and dynamic headers.
Formatting numeric fields correctly.
Handling page breaks efficiently.
I hope you found this guide helpful! Let me know your thoughts in the comments. If I missed anything, feel free to share your feedback, and I’ll make sure to address it in future posts. Thank you for reading, and happy reporting! 🚀
Saurav Dhyani
Comments
Post a Comment