PRAAM04

Jasper Report in HTML Portlet

Blog Post created by PRAAM04 Employee on May 31, 2018
  1. Create copy of a particular report.
  2. Select object's id on the basis of sub-object id within the query. For instance, my report runs on the basis of "Project ID" & I want to run that report for action item created for "Status Report" sub-object as well. So, the url for a particular status report will provide the sub-object id & that Id will be passed to my parameter which is expecting Project ID. In my query, I've used "Select odf_parent_id from tablename where id=parametername" for getting the project id.

 

Sample Code of HTML Portlet:

 

<head>

<style
type="text/css">

   html, body, div, iframe { margin:0;
padding:0;}

   iframe { display:block; width:100%;
border:none; }

</style>

<head>

<div>

  <iframe id="myiframe"
frameborder="0" border="0"
height="600"></iframe>

</div>

<script>

var url1 =
window.location.href;

var str1=
“/reportservice/flow.html?_flowId=viewReportFlow&_flowId=viewReportFlow&standAlone=true
&reportUnit=/Customer_Custom/Action_Item/CSK_PRJ_ProjectStatusDetail&projectKey_1=";

var location1 =
url1.indexOf("id=");

var projectid =
url1.substring(location1 + 3, location1 + 10)

var myiframe =
document.getElementById('myiframe');

  1. src = str1
    + projectid;

</script>

Key HTML Code
Concepts

 

HTML Reference

Description

Derived Location

reportservice/flow.html

Application page reference

 

&_flowId=viewReportFlow

Execution action. (report,ad-hoc view,dashboard, etc…)

Object type to be executed

&reportUnit=/Customer_C…%

Path to report location

Repository location with report id appended. The final value in the string is the report id. Can be copied from url when directly logged into JasperReports Server.

&projectKey_1

Parameter id associated with report parameter

Report input control reference.

Var location1

Variable storing identifier for substring locations

Set the index based on value in url

Var projectid

Substring to pull id from url based on location index

Modify based on start and end locations of key field in the url

Var myiframe =

Leverage ‘myiframe’ technology

 

A.      Myiframe.src=

Concatenate the url ‘str1 variable with projectid variable

 

&decorate=no

Hide JasperReports Server Main Menu bar

 

&output=

Dictates report output. (pdf, html, excel, etc…)

 

Outcomes