Welcome to K2 Underground Sign In | Join | Help

Extending a K2 Report in Visual Studio

 

UPDATE:  A similar K2 Knowledge Base article on how to add a Chart to you reports also exists here - http://kb.k2workflow.com/articles/kb000189.aspx

Scenario: We have built a travel request process that stores the details of each travel request in SmartObjects.  Our business requests that they want reports to have column displaying the total duration of each travel request.  Of course the Workspace report designer makes it very easy for us to create the main report but doesn’t provide facility to do calculations. 

As you may know, K2 reporting leverages SQL Server Reporting Services (SSRS).  This makes it easier than ever to produce exactly the right report for the job.

For this post I’ll assume that you have already created a basic report on the Travel Request Details SmartObject that can use as a base.

First a task overview:

  •  <!--[endif]-->Create initial report
  • <!--[if !supportLists]--><!--[endif]-->Download report definition from SSRS
  • <!--[if !supportLists]--> <!--[endif]-->Add report to Visual Studio Report Server project
  • <!--[if !supportLists]-->Modify report
  • <!--[if !supportLists]-->Redeploy to SSRS
  • <!--[if !supportLists]--> <!--[endif]-->Use report
    • <!--[if !supportLists]--> <!--[endif]-->Either import to the Workspace,
    • <!--[if !supportLists]--><!--[endif]-->Reference on ASP.net pages with the Report Viewer control
    • <!--[if !supportLists]--><!--[endif]-->Or add to SharePoint pages with the Report Viewer webpart

As said above I’ve assumed that you have already created the initial report.  So, let’s jump straight to the second step and download our report definition (RDL file) from SSRS.

Downloading the report is easy, just choose the Edit option from the properties of your report on the SSRS web-site.  K2 reports are deployed to a folder called “Reporting” by default.  Our SSRS URL will be (http://blackpearl/reports). 

Save the file in a convenient location:

 

Next Open a new Visual Studio Report Server project from the Business Intelligence section,and then add the downloaded report file to the project.


 


Next modify the report by adding a new “Duration” column to the table.  Do this by selecting the end column then right-clicking the grey block at the top of the table.

 

Next right-click the new cell and select “Expression” then build an expression of:

=Fields!TravelRequestDetails_EndDate.Value-Fields!TravelRequestDetails_StartDate.Value

This assumes that your SmartObject is called TravelRequestDetails.  You can select your SmartObject fields from the Fields section of this dialog.

 

Finally, OK this expression.  Then add a header such as Duration in the table cell just above the new expression.

You can now preview the report by selecting preview in Visual Studio

Note our new Duration column.

You can now redeploy the report to SSRS by modifying the Project properties and adding the Report Server web-service URL (http://blackpearl/ReportServer).  Then just right-click the project and Deploy.


 

 

After deployment you can import to the K2 Workspace using the Reports section of the Workspace and the Import from Reporting Services feature, or use the report in another manner.

 

The report will be deployed to a folder on the Reports Server website named the same as your Report Server project.

Of course SSRS provide many more advanced features but this should serve as a base to get you started.

Good luck!

 Ashley
 

Published Thursday, May 15, 2008 10:38 PM by ashley@k2workflow.com

Comments

# Customizing Out of the Box K2 Reports and Replacing the Originals

Friday, May 23, 2008 7:28 AM by From The Bench

There are multiple articles on exporting SQL Reporting Services “.RDL” files from SQL for customization

# re: Extending a K2 Report in Visual Studio

Friday, May 30, 2008 4:24 AM by japergis

Absolutely awesome... Jason

Anonymous comments are disabled