Wednesday, June 2, 2010

Drill Through from a primary BIRT report to a secondary BIRT report


You can use the interactive features of BIRT to allow the user to click through/hyperlink from a primary report to a secondary report.

Because both reports will eventually in the AiM document repository, a certain sequence must be followed when creating the links between the two reports.

First, draft the primary report. Then draft the secondary report. Place the secondary report into the document repository. The document repository is comprised of a bunch of folders with names like 1341 and 1342. Inside the 1341 folder will be a document titled 1341_0. In order to have link between the two reports that will work on your desktop during development and in production on the AiM server, you need to create a relative path between the two reports similar to what would be found on the server.

Put the secondary (or target) report in the document repository. Note the tranx_num. On your desktop, create a folder in the same directory as the primary report. Name the folder with the tranx_num. Place the secondary report in the folder and rename it to the tranx_num, plus _0. It should be something like this (1341_0.rptdesign)

Now go to the primary report and create the linkage using the interactivity/hyperlink features in BIRT.

Fastest way to do this is to create the reports in Birt first without the linkages between the reports, the put the reports into Aim, create the corresponding folders on your desktop to create the relative file structure and THEN create the interactivity. If you find yourself having already created the linkages, you'll have to rebuild them once you get the file structure established.

Update: Since 5.0, there are some changes to the doc repo that affect how drill throughs function. First, I did the drill through hyperlink as url as opposed to a path described above. Maybe it works with path as well, but I was more comfortable with url.

First create both the reports with no hyperlinks/drill throughs. Name them something like primary and secondary to keep it straight. For the secondary report, create report parameter(s) that you intend to pass data to from the primary report. Make the parameters required. Place that report into Aim via report manager and run it to make sure it works. When you run the report, copy the url and paste it into notepad.

It should be something like:
https://gwuapp.assetworks.com:8443/reportviewertest/frameset?__fmaxDocId=0EE1E3FC-D340-45A4-ACA8-87C999166CAF&__fmaxReportId=1094&ph_shop=WC14

where ph_shop is the parameter value and everything up that refers to the report manager and doc repo.

Go to the primary report. Select the field that will be your hyperlink/drill through. Select hyperlink in properties. Select URI in the next radio button. Then bring up the expression builder. You are going to build a javascript expression to describe the target report.

Paste the copied url from notepad into the window. Put a double quotes at the begining and delete the parameter value string (like WC14 in the example) and put double quotes at the end.

Then add a + and select the row value corresponding the hyperlink.

Should look like this:
"https://gwuapp.assetworks.com:8443/reportviewertest/frameset?__fmaxDocId=0EE1E3FC-D340-45A4-ACA8-87C999166CAF&__fmaxReportId=1094&ph_shop="+row["ph_shop"]

Load the primary report into Aim report manager. Run it and test.

No comments:

Post a Comment