Hyperlinks do not work when a Birt report is exported into Excel, PDF, ...
Hello all
I have created a report with BIRT for RTC V 4.0.1.
The report shows a list of workitems. The column Work ID is linked through a hyperlink to the workitem.
The code for creating the url is:
var serverURL = reportContext.getAppContext().get("SERVER_URL");
if (serverURL == null) serverURL = "";
workitem.url = serverURL + "#action=com.ibm.team.workitem.viewWorkItem&id="+row["WI_ID"]
When I run this report in RTC the work item opens successfully when I select the link.
When I export this report from RTC into Excel, PDF, Word or ... the links do not open the work item.
May I ask someone to help me to resolve this issue. Thanks in advance.
Regards,
Hansruedi
Accepted answer
Hansruedi, Thanks for sending me the report design. Here is what is happening:
The URLs your report are generating are relative. You can find that out by making the report output the value: row["url"].
I can probably guess your next question: But you are prefixing the URL with: reportContext.getAppContext().get("SERVER_URL")
The above call will always return null unless someone is trying to display a report or a report viewlet that is coming from a different jazz server. So our reports always try to use relative URLs unless it is necessary to use full URLs.
So you cannot trust reportContext.getAppContext().get("SERVER_URL") to give you the server URL.
I will change your defect into an enhancement request and start passing another variable: FULL_SERVER_URL that is guaranteed to always contain the server URL.
Until then, you will need to hard code the server URL in your report or pass it as a parameter.
The URLs your report are generating are relative. You can find that out by making the report output the value: row["url"].
I can probably guess your next question: But you are prefixing the URL with: reportContext.getAppContext().get("SERVER_URL")
The above call will always return null unless someone is trying to display a report or a report viewlet that is coming from a different jazz server. So our reports always try to use relative URLs unless it is necessary to use full URLs.
So you cannot trust reportContext.getAppContext().get("SERVER_URL") to give you the server URL.
I will change your defect into an enhancement request and start passing another variable: FULL_SERVER_URL that is guaranteed to always contain the server URL.
Until then, you will need to hard code the server URL in your report or pass it as a parameter.
Comments
Alanna Zito
JAZZ DEVELOPER Jan 02 '13, 9:36 a.m.Can you be more specific about what happens when you click on the link from the exported report? Do you get an error, or is the link itself incorrect?
Hansruedi Ehrenberg
Jan 04 '13, 1:29 a.m.When I run the report in RTC a correct link is e.g. https://bt-clmserver01.hqs.sbt.siemens.com/ccm/web/projects/GDT%20Process%20and%20Infrastructure#action=com.ibm.team.workitem.viewWorkItem&id=7074
The mouse over on the same link in the Excel exported report shows the following link file:///C:\Users\EhrenbeH\AppData\Local\Microsoft\Temporary Internet Files\Content.IE5\IEYMS708\Report[1]xls - auto_generated_bookmark1.
When I click this link I get the error 'Reference is not valid.
I hope you can help me to resolve this issue. Thank you in advance.
Millard Ellingsworth
FORUM ADMINISTRATOR / JAZZ DEVELOPER Jan 04 '13, 1:49 p.m.Does the code you showed above put a hard link into the report (which should export correctly) or dynamically calculate the link? If it is dynamically calculated, it is unlikely that the "export to X" process exports the code for making the link (and there's a chance that code couldn't execute successfully in the exported environment anyway). For this to work, the exported link needs to be the same as the link in the report. Is it possible to re-work the report implementation so that the link is exportable?
Hansruedi Ehrenberg
Jan 15 '13, 9:27 a.m.Hello Millard
this is exactly my question: how do I have to implement the code for the link that the link will be the same in the exported report as it is in the RTC report. Can you help me?
Do you have an example?
Rafik Jaouani
JAZZ DEVELOPER Jan 15 '13, 1:52 p.m.Can you please open a defect in RTC and attach a sample report that duplicates the problem?
Hansruedi Ehrenberg
Jan 16 '13, 8:47 a.m.Sorry, may I ask you for the link that I can open a defect in RTC?
Alanna Zito
JAZZ DEVELOPER Jan 16 '13, 9:06 a.m.You can log a defect against Jazz Foundation here: https://jazz.net/jazz/web/projects/Jazz Foundation
Hansruedi Ehrenberg
Jan 17 '13, 8:49 a.m.Hello Rafik
I can not create a defect in RTC and attach the sample report. I got a permission denied error. Does it give another way to send you the report example?
Hansruedi Ehrenberg
Jan 18 '13, 8:43 a.m.Hello Rafik I have created the Defect 247880 in RTC and have attached the example report design. Thanks in advance for your help.