Introduction:
Running a reporting services report in Cloud is an easier task, here in this article we will consume ODATA OGDI data source and make it available in the cloud using the Report Viewer control. Report Viewer will be used in many ways like it has the default controls on to it for exporting the result to excel or pdf, inbuilt page navigation and printing facilities. Also the Report Viewer which comes with Visual Studio 2010 is Ajax enabled so that we can have a rich user experience.
Let us now see the step by step process on how to create a new application in Windows Azure, and create a report using the Report Viewer and Deploying the report to the cloud.
Steps
Open Visual Studio 2010 by going through Start -> Programs -> Microsoft Visual Studio 2010 -> Microsoft Visual Studio 2010 in Administrator mode by right clicking and Selecting Run as Administrator as shown in the screen below.
NoteWe need to run Visual Studio 2010 in administrator mode

Now go to File -> New Projects in Visual Studio IDE, We will get a window as shown in the screen below. Select the appropriate options as shown
- Select Cloud option in the left menu
- Select Windows Azure Project template
- Change the Name of the project as user friendly
- Provide a valid location to access the project in future.
- Provide a valid Solution Name, When we handle multiple projects then this will provide very good readability.

Now we will see a window with different role available with Windows Azure as shown in the screen below.
- ASP.NET Web Role
- ASP.NET MVC 2 Web Role
- WCF Service Web Role
- Worker Role
- CGI Web Role

Since in our sample we are going to build a simple Web Report using the Reporting Services we will select ASP.NET web role by clicking on the > button as shown in the screen below. Now click on the OK Button to proceed further.

Now the designer view is opened for any changes to be made for the application overview, and we can see 2 projects have been added to the solution as shown in the screen below.
- ReportonCloud – Azure Application with the Definition and Configuration files
- WebRole1 – ASP.Net Web Role application which has our default pages
- Content – User content portion, should be changed based on our business requirement.

Now we are ready with the project, in order to prepare a report we need some Analytical data to be manipulated and shown as a result. To proceed with the example we have different data sources to be considered for fetching the data, to make a simple process we are now going to use ObjectDatasource as the source for our data.
So to use Object Data source, we are going to use a online data service which is nothing but ODATA (Open Data Protocol). ODATA is nothing but a web protocol for querying the data which provides different communication options for different applications to query and use it. We can get more information about ODATA from the site www.odata.org. In our sample we are going to use the ODATA Provider OGDI(Open Government Data Initiative) to get the data and display it to the report and publish it to the cloud.
To get the OGDI data features we should navigate to www.Odata.Org/producersand select the Open Government Data Initiative as shown in the screen below. Clicking on the browse button will show the metadata path for the application.

To get some basic idea on the Open Government Data Initiative check the website www.ogdisdk.Cloudapp.Net. We can get the complete code for the OGDI using the link given in the home page of the site which points to www.ogdi.Codeplex.Com as highlighted in the screen below.

Now click on Browse the data and it will navigate to the path http://ogdi.Cloudapp.net/v1/ , where OGDI maintains different versions (v1, v2 etc) we go with V1 here. Navigating to the path we can see the document tree which holds the different data sources which are available with the OGDI ODATA service as shown in the screen below.

Now we will select the DC (District of Columbia) service and navigate to the path http://ogdi.Cloudapp.net/v1/dc. We can see the different options available under DC as shown in the screen below. Out of the options available we will select one title to be used to fetch data and show it as a report.

Now we got the Source data service http://ogdi.Cloudapp.net/v1/dc, to proceed further and get the data to the application source we need to follow the below steps.
Right click on the Application Name(WebRole1) and go to Add Service Reference as shown in the screen below.

Now copy and paste the ODGI Data Source (http://ogdi.Cloudapp.net/v1/dc) to the Address bar, then change the Namespace to DCService and click on GO button as shown in the screen below

We can see the progress of the data source been searched as shown in the screen below.

Once the search is completed, we can see the metadata been added to the Services section and it shows that 1 Service found at the address mentioned as shown in the screen below.

Now expand the services metadata and we can see the different services available(eg BankLocation, Building Permits, Hospitals etc.) as shown in the screen below.

In our sample we will select Hospitals from the list of services and click on the OK button as shown in the screen below.

We can see the service(DCService) has been added under the Service Reference section as shown in the screen below.

Now let us add a class and do some manipulations to gather the data from the data source (DCService) and display in a format which is user friendly. To add a class, Right Click on the Application Name (WebRole1) and select Add -> Class as shown in the screen below.

Now a window will be opened with the list of available templates, from the list select the Class template and name it as DCDataSource.cs and click on ADD button as shown in the screen below.

A new class template window will be opened as tab, with the class name as DCDataSource, and also we can see the DCDatasource.cs file in the list of the solution explorer as shown in the screen below.

To proceed further we need to import the DCService under the System tag by adding as shown in the below screen.

Now we will add some logic to fetch the data from the data source (DCService) and list it as shown in the screen below.
- Connect to the Data Source
- Query the Data Source table
- Return the result

Now go to the Default.aspx page from the solution explorer and we can see a design as per our requirement as highlighted in the screen below. Now we are done with selecting some appropriate data to fetch and show in the report, to have check if the process works good from the OGDI Data Service and we get correct response we will create a small sample in the page itself to fetch and get the result to display in a grid.
To proceed further drag and drop the Object Data source from the Toolbox Data tab at the left side menu as shown in the screen below.

Once the Object data source is added now we need to configure the data source. To do that click on the Configure Data Source as shown in the screen below.

Clicking on the Configure Data Source will open a window wizard to process our request as shown in the screen below.

When we click the Choose Your Business Object drop down we will not see any business entity listed. To get the business objects save all the open pages and refresh the project.

Once we refresh the application project, we can see the list of available business objects and entities as shown in the screen below. Now select the WebRole1.DCDatasource object model from the list and click on Next button to proceed further.

Now we need to select a method from the object model, since we have created only one method (getHospitalList) select that from the drop down list and click on Next as shown in the screen below.

Now we are done with the Object Data Source configuration, now we need to have a control to display the end result. To show the result Drag and Drop a Grid view from the Data tool box to the Designer window as shown in the screen below.

Now we need to configure the Grid view to fetch appropriate data, in order to do that click the Choose Data Source drop down box and we can find the object data source (Objectdatasource1) which we created as shown in the screen below.

Selecting Objectdatasource1, will show the list of columns with default values in the designer view itself. We can delete or hide the columns as per our requirement. Also we can enable paging and selection if required which is very handy as shown in the screen below.

Now we are done with the design and fetching the data from the ODATA to shown it in a grid, to test the process works correctly or not Press F5 function key directly from the keyboard or press the button in the IDE itself as highlighted in the screen below.

We can see the result in the webpage ( ODATA Service data) as shown in the screen below.

Now we are good with fetching data from the OGDI and showing it in a Grid view temporarily. So our sample in this article is to show the data using the Reporting services Report. To add the report to our application Right click on the Project(WebRole1) and select Add –> New Item as shown in the screen below.

Now from the list of template groups select Reporting(Left Menu) and select Report template as shown in the screen below.
- Reporting left Menu group holds the templates for reporting
- Report template is used to design the report in much required format
- Valid name for the report(normally used if we have multiple report templates used in our project)
- Add button to add it to the project

New report window will be opened which will have a designer page (1) and a toolbox (2) and Report data (3) as shown in the screen below.
- Designer Page - Used for designing our report as per our requirement
- Toolbox - to add the controls required for the designer page
- Report Data - Contains some built in parameters, fields and images to be used in the report design

To design our report, drag and drop the Table control to the designer window which will open a pop up for configuration as shown in the screen below.

Now we need to configure the table as shown in the screen below like
- Name – A valid user friendly name to identify the dataset for future use
- Data Source – To select from which data source we need to show the data in our report
- Fields – Selecting the data source will provide the list of available fields to identify the data types to do some manipulations
- Available Dataset: To Select the available datasets in the data source(Since we have only one method it will show that dataset(GetHospitalList)
Now click on OK button to configure the selections for the table.

Now we can see a new table is created with Header and Data sections as shown in the screen below.

We can rearrange the table as per our requirement as shown in the screen below.

Now we need to select which data should be shown in the report, to do that in the Data Column click on each cell will pop up the list of available columns as shown in the screen below.

Select the appropriate columns to be shown for each cell and we can see the header is automatically added to each selection as shown in the screen below.

We can change the Header name as per our requirement by clicking the header cell and typing the desired name for each column as shown in the screen below.

Now we are done with the design of the report, to show the report we need to have a control which reads the report file. To have that report shown in our page select the Report Viewer Control from the Reporting tool box in the Default.aspx and drag and drop it to the page as shown in the screen below.

Now we need to select the report design which we selected in the Choose Report drop down as shown in the screen below.

Now go to the properties window of the control and check the Height and Width of the report as shown in the screen below.
NoteClick on the icon highlighted in order to get the property window

Now change the Height and Width of the report to 100% as shown in the screen below.

To process the report viewer in the Asp.Net webpage we need to have Script Manager, so drag and drop a script manager from the AjaxExtensions tab as shown in the screen below.

Now Press F5 function key or hit the run button of the Visual Studio IDE to build and execute the project. We can see the desired output as shown in the screen below.

Now we can see our application is running locally, to make it to the cloud we need to publish the application to the cloud. Right click on the Azure application and Select Publish as shown in the screen below.

We get an option to deploy the application to the cloud directly or create a service package only. We select the Create Service Package only to have control over our deployment process as shown in the screen below.

Now the package file and service configuration files will be created for our report application as shown in the screen below.

Now Login to the management portal using the link http://www.microsoft.com/windowsazure/
Select the Sign into Management portal at the top right corner

After selecting that sign in to management portal you will be asked for the Username and Password to authenticate the process as shown in the below screen

Once we gave the correct credentials and click on submit button will navigate to the main screen of the portal as shown in the below screen

Now click on the New Production Deployment and provide some informations as shown in the screen below.
- Subscription – On which subscription the application is going to be hosted
- Service Name – Under which service the application is going to run.
- Deployment Name – Provide a valid deployment Name
- Package Location – Select the package file which we got when publishing our application
- Configuration Location – Select the config file which we got when publishing our application
Click on OK button to proceed further.

We can see that the package is been uploaded to the server as shown in the screen below.

Finally we can see that the application is uploaded and configured successfully to the Cloud server as shown in the screen below.

Clicking on the DNS name (URL) we can see our report application available on the cloud as shown in the screen below.

Summary
So in this article we have seen how to use the Reporting Services to run a report on the cloud using the Windows Azure Management Portal by consuming ODATA OGDI Services.
About Karthikeyan Anbarasan
 |
Sorry, no bio is available
This author has published 6 articles on DotNetSlackers. View other articles or the complete profile here.
|
You might also be interested in the following related blog posts
MSDN Guidance on ASP.NET MVC vs WebForms and its Impact on my EF + ASP.NET Work
read more
Exporting SWF & FLV format reports in SSRS 2005 and 2008
read more
Stimulsoft Reports. New versions of reporting tools for .NET, Web, and WPF
read more
Building Cloud Applications: Windows Azure vs. Google App Engine
read more
Telerik Launches RadControls for Silverlight 3 for Line-of-Business Application Development
read more
Report writer for WPF. Long-expected tool.
read more
So Much Is Happening The Silence Is Deafening!
read more
Intersoft Solutions Releases WebUI Studio 2009 The Worlds Most Innovative Web Development Toolkit
read more
Stimulsoft Reports Designer.Web. Easy work.
read more
Stimulsoft Reports.Net version 2009.1 released. Expanding potential.
read more
|
|
Please login to rate or to leave a comment.