Introduction to Infragistics Reporting

[Infragistics] Mihail Mateev / Thursday, November 10, 2011

In the new NetAdvantage vol.2011.2 you could enjoy the first RTM of amazing Infragistics Reporting.

NetAdvantage Reporting is a tool that allows developers to create modern, innovative, visually appealing reports by providing an easy-to-use design experience in Visual Studio. It is possible to create easily reports for Silverlight and WPF without any code. Coding is only optional if you want to change something programmatically.

Some of the most important features of the Infragistics Reporting are:

  • Built entirely in XAML-capable platforms, both the designer and engine
  • Client-side or server-side rendering for Silverlight and WPF
  • Full Visual Studio integration
  • Integrated charting
  • Rich data connectivity to supporting SQL Database, Entity Framework, RIA Services, OData and any other data source through our ObjectDataSource.
  • Exporting to industry-standard formats like PDF MS Excel and XPS.
  • The design surface offers innovative tooling and intuitive interfaces

Infragistics Reporting Modules

Reporting contains several main parts:

  • Report Designer
  • Report Data Explorer
  • Report Service
  • Controls
  • Expression Assistant

Report Designer

Anatomy of the Report Designer

The Report Designer is the work environment of NetAdvantage Reporting, the place where you design and layout your reports.

  

The Report Designer is a Reporting System integrated by the following components:

  1. Alignment Configuration Toolbar - This toolbar is used for resizing and aligning the items placed on the Design Surface. For details, refer to The Alignment Configuration Toolbar.
  2. Designer Surface - The largest area of the Report Designer, divided into several sections. It is the actual work area in which you design your report. For details, refer to Knowing the Designer Surface and Report Sections.
  3. Report Data Explorer Window - This component is used to create, modify, and display data sources and parameters. For details, refer to The Report Data Explorer.

 

Report Data Explorer

The Report Data Explorer is part of the NetAdvantage Reporting work environment. This Report Designer component displays, in a treeview-like form, the available data sources (with their corresponding data fields) and the parameters’ definitions. You are allowed to create, modify, and display data sources and parameters. The menu at the top of the Report Data Explorer facilitates all required operations with data sources and parameters.

  

Report Service

The Report Service is a Windows Communication Foundation (WCF) service that allows the remote execution of NetAdvantage Reporting reports. It is typically used in scenarios in which reports are rendered in Silverlight or WPF clients, and connecting directly to the database is not an option. Reports are always processed on the server and the only information that the client receives is the final result.

 

Controls

Reporting controls represents a specific report component that has particular features and functionalities for displaying content, and can be inserted in any report at design-time. NetAdvantage Reporting comes with Table, Chart, Label, Image and Horizontal Line controls.

 

Expression Assistant

The Expression Assistant dialog is the tool you use to build the expressions needed for your report. This dialog has several distinct areas; the purpose of each of them is explained briefly below.

In the NetAdvantage Reporting tool, expressions are created in the Expression Assistant dialog. The Expression Assistant allows you to create custom expressions easily, providing a set of predefined and categorized elements to be used when building the expression.

Visual Elements of the Expression Assistant dialog

  

  1. Expression area - The expression you are building is displayed in the text field of this area.
  2. Operators area - In this area you can select operators to add to the expression.
  3. Fields, Variables and Parameters area - Select database fields, global variables, and parameters to add your expression.
  4. Functions area - All functions that you can add to the expression are available here.

 

Report Rendering

 

  • Server-Side Rendering. In this case, the Viewer retrieves a report from a Reporting Service (ReportService.svc). This schema separates the report’s user interface handled by the Viewer (the client side) from the actual report and rendering engine that run on the server.  Server-side rendering requires a running Report Service. The code handling this looks as shown below.
   1: <ig:XamReportViewer HorizontalAlignment="Right" Margin="0,78,0,0" Name="xamReportViewer1" VerticalAlignment="Top">
   2:     <ig:XamReportViewer.RenderSettings>
   3:         <ig:ServerRenderSettings DefinitionUri="/MyAssembly;component/MyReport.igr" ServiceEndpointUri="http://localhost:5172/ReportService.svc" /> 
   4:     </ig:XamReportViewer.RenderSettings> 
   5: </ig:XamReportViewer>
  • Client-Side Rendering  NetAdvantage Reporting supports also client-side rendering in Silverlight, which works without involving the Report Service. This second scenario requires that the data needed for the report is already located in the client (i.e., in XML files, through RIA Services, or any other web service call).   With client-side rendering the report is fully rendered by the client without any server participation. The implementation of client-side rendering settings uses the ClientRenderSetting tag as shown below.
   1: <ig:XamReportViewer HorizontalAlignment="Right" Margin="0,78,0,0" Name="xamReportViewer1" VerticalAlignment="Top"> 
   2:     <ig:XamReportViewer.RenderSettings> 
   3:         <ig:ClientRenderSettings DefinitionUri="/MyAssembly;component/MyReport.igr" />
   4:     </ig:XamReportViewer.RenderSettings> 
   5: </ig:XamReportViewer>

 

How to start with Infragistics Reporting.

In this article you could learn how to start with NetAdvantage Reporting. Sample application is Silverlight application , that create fully functional reports from Northwind sample database without code!

Requirements:

 

Steps to create sample report

  • Create Silverlight Application

  

  • Add Infragistics Report

In the Web project add new item->Infragistics->Reporting->Infragistics Report

  

Report will propose you to create a Report service (server-side rendering is a default).

  

Report will add assembly references in your Web project.

When you select NorthWindReport.igr in the Visual Studio you will see the Report Designer with Designer Surface

  • Data source configuration

Click over the Add a Report Data Source… message on the Designer Surface

 

 

Data Source Configuration Wizard appears.

  

Select database

  

Select tables and/or views (in this case “Customer and Suppliers by City” view)

 

 

Modify the query expression to filter only customers (without suppliers) :

   1: SELECT [City]
   2:       ,[CompanyName]
   3:       ,[ContactName] FROM dbo.[Customer and Suppliers by City]  Where Relationship='Customers' 

  

  • Report Design

Drag NorthwindDataSource from Report Data Explorer to Designer Surface.

  

  

Open NetAdvantage Reporting Controls from Toolbox and add report title and image in the report front page.

  

Click on the “Preview” tab to preview the report in design mode.

  

  

  • Add a Report Viewer in the Silverlight client

Add a XamReportViewer control in the MainPage.xaml from the Silverlight client application.

Click over the XamReportViewer  control in Visual Studio 2010 designer to choose the Report Service (Server-Side Rendering is a default render approach).

 

  

ServerRenderSetting section will be added automatically in your XAML.

   1: <ig:XamReportViewer  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="20" Name="xamReportViewer1">
   2:     <ig:XamReportViewer.RenderSettings>
   3:         <ig:ServerRenderSettings DefinitionUri="/ReportingDemo.Web;component/NorthWindReport.igr" ServiceEndpointUri="http://localhost:2934/NorthWindReportService.svc" />
   4:     </ig:XamReportViewer.RenderSettings>
   5: </ig:XamReportViewer>

 

Run the application to review the report

 

  

  

  • Group Data in Infragistics Report

It is enough just to drag the filed that will group the data from  Report Data Explorer to group area on Designer Surface.

  

  • Expression Assistant

Use an Expression Assistant to add page numbers in your report.

 

  

Run the report to review grouping and page numbers.

  

  • Add Parameters to Report

Edit data source

  

Change the query:

   1: SELECT [City]
   2:       ,[CompanyName]
   3:       ,[ContactName] FROM dbo.[Customer and Suppliers by City]  Where Relationship='Customers' And City=@City

 

In the next step for parameter “City” select action “Add Static Value List Parameter…”

An “Add Static Value List Parameter” form appears and you should  set required parameter settings (name, type, default value).

  

Drag parameter to page header area on the Designer Surface. Add additional label to represent the current filter in the report.

  

Run the application and add the required parameter. Enjoy the completed report.

  

 

  

  • Export an Infragistics Report

Select “Export” option from the application toolbar, choose “PDF” format  and select a file name to save the report.

  

Enjoy the exported report.

  

  

Demo application you could download here:

The outstanding new NetAdvantage Reporting Vol.11.2 offers also many other features like client side rendering, printing, multi level report support, sorting, enhanced formatting etc. Expect next blogs from Infragistics  about these features. Follow news from Infragistics in https://www.infragistics.com/ and twitter: @infragistics for more information about new Infragistics products.