With a complete set of controls and extensive API, ActiveReports is a flexible .NET report generator. Design reports right in your Visual Studio projects.
In this post, we’ll demonstrate how to create a report in ActiveReports. The video demo takes you through this process, step-by-step.
Watch the ActiveReports demo video:
Create a new project in Visual Studio
Let’s look at creating a simple tabular report of our stock inventory grouped by each product category. We’ll start off by creating a new project in Visual Studio. We’ll select the RDL report template and enter a project name.
Let's establish a connection to our local SQL database. We’ll right-click the Data Sources node in the Report Explorer to add a data source.
In the Report Data Source dialog box, we’ll name our data source, enter the server name and authentication information and then select our dataset.
With the data source connection established, let’s create a dataset to pull data from our server. Right-click the data source connection we just created and select Add Data Set.
Create the web report layout
In the DataSet dialog box, we’ll name our dataset. Then on the Query tab, we can either use the Query Builder to build our query by clicking the pencil icon, or we can enter our query right in the dialog box. Validate it. And click OK to close.
Next, we can create the layout of the report. From the toolbox, drag a Table control onto the report design surface. Since we’ll be creating a report of our stock inventory, we will group the data by the ProductCategoryID field.
Right-click the Table Row Headers and select Insert Group.
On the dialog box’s General tab, we’ll enter an equal sign -- followed by the field name that we want to group in brackets -- and click OK.
We don’t want the Table Header and Footer included here, so right-click on the row headers -- and de-select the Table Header and Table Footer from the context menu.
We'll add another column to the table by right-clicking a column header and selecting Insert Column.
In the Details row, we will use the Field Selection Adorners to bind each column to a field in our database. We’ll assign the Product Name, Color, ListPrice, and Size to each of our columns.
Notice the column headers are automatically populated. Let’s format this row of column headers to be bold and left aligned. We will also give this row a solid bottom border and left align the detail row.
Let’s select the ListPrice column and change its format to currency from its property menu. Rename this column header to Price.
We want to aggregate the value of each grouping. In the group footer, click on the field selection adorner in the cell where you want to display the aggregate and select the ListPrice data field.
Enter a Total Value string in the cell below it. I will make both cells bold. Select the group footer row and give it a solid top border.
Let’s preview it. We can see we need to make some adjustments to the layout. We need to make the first column wider to accommodate the product name.
We would like an image of each grouped item at the top of the grouping.
In the design view, we’ll make the first column larger -- then right-click on the row header and select Edit Group. On the Layout tab of the dialog box, we’ll ensure that the keep together on one page and Prevent orphaned footer checkboxes are checked.
Next, let's place the image of each product at the top of each grouping.
Right-click the top row’s row header and select insert row above. Let's place an image control in the very first cell by dragging and dropping the image control from the toolbox.
In the Properties of this image control, change the Source field to Database and the Value to my database field containing the thumbnail image.
Previewing, the sizing looks right now. We also see that the groups are kept together as much as possible. The only thing left is to format the aggregate to show currency. We’ll quickly take care of that in the design view.
Be sure to follow GrapeCity’s blog page in the coming weeks, as we’ll be offering more details on product new features, demo videos, industry news, and more!
Create engaging reports quickly and easily Download the latest version of ActiveReports
Create engaging reports quickly and easily
Download the latest version of ActiveReportsDownload Now!