Prashank Singh

Running Jaspersoft Report within CA PPM Object

Blog Post created by Prashank Singh on Jul 3, 2017

Most of us are still struggling to run the reports as we used to run, when BOxi was still part of CA PPM reporting. Now, BOxi is not part of CA PPM from 14.4 Version. We have started missing the functionality to run BOxi reports via Action Menu from CA PPM Objects or via Link from Object List.

We can still achieve similar functionality, however it needs bit more work as compared to that of earlier BOxi times.

 

Before we go through running Jaspersoft within CA PPM, we need to understand basics of Jaspersoft integration methods.

Jaspersoft integration methods are:

1) Embedding using HTTP API

2) Getting Started with REST Web Service API

3) Getting Started with Visualize.js

 

We are going to use HTTP API for running reports within CA PPM. Let's learn some basics of URL for Jaspersoft report.

 

Jasper URL: <constructing this as below>

Base URL : /reportservice/flow.html?_flowId=viewReportFlow

Report  URL: &reportUnit=/shared/reports/ProjectEffortReport

                        &standAlone=true

                        &ParentFolderUri=/shared/reports

Report Input Parameters:  &ptype=0

                                              &year=2016

                                              &Project_id=5028001&Project_id=5027020&Project_id=5005001&Project_id=5027008

Optional Parameters: &decorate=no

                                       &output=pdf

sample Jasper URL : 

You can create your own Jasper URL and try to run that by hard coding values in input parameter, similarly you can run jaspersoft Dashboard with URL as: 

                                    _flowId=dashboardRuntimeFlow

                                   &dashboardResource=/shared/reports/ProjectDashboard

                                   &hidden_projectId=5028001

 

Note: Report input control should be unchecked for prompting as shown >>

 

 

As we know, how to construct URL for jaspersoft report and Dashboard. We can now go ahead with our CA PPM integration options, like running report from:

                                                     1) Running Report from Action Menu

                                                     2) Running Report via List Link

                                                     3) Running Report via HTML Lookup (Objects Edit/Create/Filter view)

 

Let's talk about first option for running jaspersoft report via Action Menu, we need following elements:

1) New HTML Portlet 

2) New Jaspersoft report 

3) New Portlet Page with Link parameter

4) New Object Link with parameter mapping 

5) New Object Action

 

Step1:

We will start with Portlet Page and Link Parameter. Also, we need to make sure that we are going to pass value to URL from these parameter id and will be fetching these ids to pass into our report. For example, I have created a Portlet Page with Id as JasperReportTest and Parameters as project_id, year_id and ptype_id.

 

Step2:

Now, we will map these values by creating an Object Link. For example, I have created a link and I need to map project_id with Object ID;  year_id and ptype_id with custom attributes. 

 

Step3:

Create New Object Action with type as internal and select Link which you have created. Now, add this action from  Object>Views>Action Menu so that action link is available to run our jasper report.

 

Step4: Create a new html portlet and add that new portlet to page content which you have created above.

 

Since, we have setup everything correctly for sending parameter from CA PPM to url. Now, we can discuss html code, where we are going to capture these report parameters from urls and then feed these parameter values to Jasper report url which we have already tested. Then, these report url will be passed over to html iframe.

 

<!DOCTYPE html>
<html>
<style type="text/css">
 html, body, div, iframe { margin:0;padding:0;}
 iframe { display:block; width:100%; border:none; }
</style> 
   <body>
<script>
var url1 = window.location.href;
 var str1="/reportservice/flow.html?_flowId=viewReportFlow&reportUnit=/shared/reports/ProjectEffortReport&standAlone=true&ParentFolderUri=/shared/reports&ptype=";
var parameter1 =url1.indexOf("&ptype_id=");
var ptype = url1.substring(parameter1 + 10, parameter1 + 17) 
str1 = str1+ptype;

 

var parameter2 =url1.indexOf("&year_id=");
var year_id = url1.substring(parameter2 + 9, parameter2 + 16)
str1 = str1+"&year="+year_id;

 

var parameter3 =url1.indexOf("&project_id=");
var projectid = url1.substring(parameter3 + 12, parameter3 + 19)
str1 = str1+"&Project_id="+projectid;

 

var myiframe =document.getElementById('myiframe');
myiframe.src = str1;
</script>
       <iframe id="myiframe" frameborder="0" border="0" height="600"></iframe>
   </body>
</html>

 

 

Similarly, you can create a link and use that to run jasperreport via image link field from list.

Now, if you are wondering how we can use option 3 i.e via HTML Lookup, please refer to blog HTML Fancy Lookups: Getting Started.

Outcomes