How to access to standard K2 reports in your web application?

Let’s assume you want to display a standard K2 report (for example “Activity Statistics”) in your web application without doing any redirection to the K2 Workspace.


SSRS (SQL Server Reporting Services) has many great built-in features, but accessing them from external components can be tricky. What if you want to pass reports parameters directly within a URL? Wouldn't it be great if you could, from a website or an email,  point to  a URL that renders a report directly in PDF? You may also need to display a K2 report without the reporting toolbar.  Let's take a look at these items as well as a few others. Here are the steps:

  1. Find the URL of your report. Browse your reportserver web application (e.g. on Denallix: http://www.denallix.com/reportserver), then click on “Standard Reports >> Hidden”, here you have all the out-of-the-box K2 reports. Nota: replace www.denallix.com by your own SSRS web server DNS address.

  2. Select your report (e.g.: “Activity Statitics Column3D”) to display the parameters you can play with. Copy the current URL (here http://www.denallix.com/reportserver/?%2fStandard+Reports%2fHidden%2fActivity+Statistics+Column3D&rs:Commande=Render)


  3. Build your URL using the K2 parameters:
    a. FullName: <Folder>\<ProcessName>
    b. Version: <int_Version>
    c. ValueType: 0 to have average duration, 1 to have the instance numbers
    d. FromDate: start date for the report <YYYY/MM/DD>
    e. ToDate: end date for the report <YYYY/MM/DD>
    f. Status: 2 for Active, 4 for Completed
    g. EventType: 0 for all events, 1 to exclude Server Events

    Thus, assuming we want to display the average completion duration of the activities from the last version of the Purchase Request instances in the last 2 years, we will add the following string to our URL: &FullName=DenallixBP\PurchaseRequest&Version=20&ValueType=0
    &FromDate=2007/10/14&ToDate=2009/10/14&Status=4&EventType=1
    .

  4. Add some SSRS options to your URL :
    a. To hide the parameter bar, append this string to  the URL: &rc:Parameters=false
    b. To hide the toolbar, append this string to the URL: &rc:Toolbar=false
    c. To control the report format, you can append the following string to directly save the report to your local file system in the specified file format to: &rs:Format=Excel or &rs:Format=PDF

  5. The complete, final URL can be something like http://www.denallix.com/reportserver/?%2fStandard+Reports%2fHidden%2fActivity+Statistics+Column3D&rs:Commande=Render&FullName=DenallixBP\PurchaseRequest
    &Version=20&ValueType=0&FromDate=2007/10/14&ToDate=2009/10/14&Status=4&EventType=1
    &rc:Parameters=false&rc:Toolbar=false
    and will generate this:


I hope this will help you to create better K2 web applications ;-).


-- by Jean Cadeau


Posted Wed, Oct 14 2009 5:32 PM by jan