Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Help on customization of Hyperlink through ScriptedEventHandler class
Amrik
Hi,
I have a requirement wherein I need to display Header and Detail reports using BIRT and render the data through ScriptedDataSetEventAdapter class.
I have linked these reports using the 'drill through' hyperlink option, but I will have to display the hyperlink to detail report in the Header report based on data condition check, which can be done in Java handler class only.
I tried embedding the <a> tag to the data value in the Java Handler class using the following but without success-
"<![CDATA[<a href=\"DetailReport.rptdesign\">]]"+obj.getEmployeeId()+"<![CDATA[</a>]]>";
Could you please let me an how this can be implemented in BIRT 2.5.1?
Thanks in advance.
Regards,
Amrik
Find more posts tagged with
Comments
johnw
Chances are good that what your looking for is in the Javascript event handler, but its "hidden" from view.<br />
<br />
Anyhow, unless your using a Text object, you don't want to embed HTML snippets that way. <br />
<br />
You should override the onCrete method for your Data object, and create an Action and a Drill Through object. Below is an example.<br />
<br />
@Override<
;br />
public void onCreate(IDataItemInstance data, IReportContext reportContext)<br />
throws ScriptException {<br />
//create a new action instance<br />
IActionInstance newAction = data.createAction();<br />
<br />
//with the new action, create a drill through<br />
IDrillThroughInstance drillThrough = newAction.createDrillThrough();<br />
<br />
//set propertes<br />
drillThrough.setReportName("myTargetReport.rptDesign");<br />
<br />
//set parameters for report name<br />
HashMap parameterMap = new HashMap();<br />
parameterMap.put("MyParamName", "Value");<br />
drillThrough.setParameterBindings(parameterMap);<br />
<br />
//set the actions drillthrough<br />
newAction.setDrillThrough(drillThrough);<br />
drillThrough.setTargetWindow("new");<br />
<br />
//set the datas action<br />
data.setAction(newAction);<br />
}<br />
<br />
<blockquote class='ipsBlockquote' data-author="'Amrik'" data-cid="65755" data-time="1277088321" data-date="20 June 2010 - 07:45 PM"><p>
Hi,<br />
<br />
I have a requirement wherein I need to display Header and Detail reports using BIRT and render the data through ScriptedDataSetEventAdapter class.<br />
I have linked these reports using the 'drill through' hyperlink option, but I will have to display the hyperlink to detail report in the Header report based on data condition check, which can be done in Java handler class only.<br />
I tried embedding the <a> tag to the data value in the Java Handler class using the following but without success-<br />
"<![CDATA[<a href=\"DetailReport.rptdesign\">]]"+obj.getEmployeeId()+"<![CDATA[</a>]]>";<br />
<br />
Could you please let me an how this can be implemented in BIRT 2.5.1?<br />
<br />
Thanks in advance.<br />
<br />
Regards,<br />
Amrik<br /></p></blockquote>
Amrik
Hi John,<br />
<br />
I tried your below mentioned approach and it just worked fine.<br />
Thanks a lot!!!<br />
<br />
Regards,<br />
Amrik<br />
<br />
<blockquote class='ipsBlockquote' data-author="'johnw'" data-cid="65785" data-time="1277147241" data-date="21 June 2010 - 12:07 PM"><p>
Chances are good that what your looking for is in the Javascript event handler, but its "hidden" from view.<br />
<br />
Anyhow, unless your using a Text object, you don't want to embed HTML snippets that way. <br />
<br />
You should override the onCrete method for your Data object, and create an Action and a Drill Through object. Below is an example.<br />
<br />
@Override<
;br />
public void onCreate(IDataItemInstance data, IReportContext reportContext)<br />
throws ScriptException {<br />
//create a new action instance<br />
IActionInstance newAction = data.createAction();<br />
<br />
//with the new action, create a drill through<br />
IDrillThroughInstance drillThrough = newAction.createDrillThrough();<br />
<br />
//set propertes<br />
drillThrough.setReportName("myTargetReport.rptDesign");<br />
<br />
//set parameters for report name<br />
HashMap parameterMap = new HashMap();<br />
parameterMap.put("MyParamName", "Value");<br />
drillThrough.setParameterBindings(parameterMap);<br />
<br />
//set the actions drillthrough<br />
newAction.setDrillThrough(drillThrough);<br />
drillThrough.setTargetWindow("new");<br />
<br />
//set the datas action<br />
data.setAction(newAction);<br />
}<br /></p></blockquote>