Before creating any reports in ASP.NET Report Maker, you must prepare your data first.
1. Make sure ALL data are available using Views
The first thing to consider in preparing your data is to make ALL data to be displayed available in the source table.
In ASP.NET Report Maker, each report is based on a single source table (or view), you need to make sure all data are available in the source table. If you have foreign keys in your table and you want to display data from the referenced table, you should use view (or "query" in MS Access) of the your database and create joins to combine data from the tables first.
In the tutorial of Crosstab Report, we create a View first, you can see that the relationships are as follows:
The main data is actually stored in the OrderDetails table, but we obtain the following information using the joins between tables:
Company name - Use the OrderID field in the OrderDetails table to trace back to the Orders table, then use the CustomerID in the Orders table to trace back to the Customers table to get the CompanyName.
Product name - Use the ProductID field in the Order Details table to trace back to the Products table to get the ProductName.
Category name - Use the ProductID field in the OrderDetails table to trace back to the Products table to get the ProductName, then use the CatergoryID in the Products table to trace back to the Categories table to get the CategoryName.
With the company name, product name and category name present in one single source - the "Orders By Product" View, you can create reports and use them to group your data. Otherwise, you can only group by OrderID or ProductID which are only integers and make the report much less readable.
2. Filtering Data
The second thing to consider is filtering of the data. Always retrieve the least amount of data from the database for best performance.
For example, if your data ranges across 3 years and you only need to see one year data in your report each time, you can create a report and select the year at runtime (Run-time refers to when you run the generated script. Run-time filtering is well supported for users to see partial data that they are interested in), but this would mean that the ASP.NET script will need to handle 3 times the data needed to show initially. There is performance penalty if the size of your data is large and it will take a longer time for the report page to show. You have 2 alternatives:
then your report for a particular year will load faster.
After you prepare the data, connect to the database using ASP.NET Report Maker, then right click the database pane or click [Edit] and then choose [Add Report (Detail/Summary)] or [Add Report (Crosstab)] or [Add Report (Gantt)] to create a report.