Web 2.0 and BIRT

PuckPuck
edited July 28, 2021 in Analytics #1
<p><font size="3" face="Verdana, Geneva, Arial, Helvetica, sans-serif">Building web 2.0 style functionality into your BIRT report may be easier than you think. Web 2.0 requires client side javascript code, and interaction with the actual report elements after the report is generated. BIRT provides a very easy to use mechanism to enable your javascript code, direct access to any report element present in your report, and with a little bit of Javascript magic, you can provide a rich experience your users have always dreamed of.<br /><br />The secret weapon to web 2.0 enabling your reports is the "Bookmark" property present on every single report item, table cell, table row, and even entire tables themselves. Even better is this property is an actual expresison evaluated at run time, where you can leverage global variables, and data items as part of the Bookmark name. What this proprety does is create an ID attribute on the output HTML element for the given report item. Once you have an ID attribute on the output, getting a handle on it is done with a single line of Javascript code:</font><br /><br /><font face="Courier New, Courier, monospace"><font size="3" face="Courier New, Courier, monospace">document.getElementById(bookmarkName);</font></font><font face="Times New Roman"><br /><font size="3" face="Verdana, Geneva, Arial, Helvetica, sans-serif">To output "data driven" javasript code, you would make use of the Text Item element, with a format set to HTML. Type up your javascript code inside of standard <SCRIPT> tags. To data drive this code, you would make use of a special tag called "value-of" Anything contained wihtin this tag is evaluated like any other expression wihtin the context of a BIRT report. So to call a javascript function based on a ID column that is part of the dataset, the contents of your Text Item would be similar to this:</font><br /><br /><font size="3" face="Courier New, Courier, monospace"><SCRIPT><br />myCustomJavascriptFunction("<value-of>row["ID"]</value-of>");<br /></SCRIPT></font></font><font size="3" face="Verdana, Geneva, Arial, Helvetica, sans-serif">With bookmarks setup to use the same ID column from the row as part of the bookmark name, you can now get a handle on individual elements of that record, do some Javascirpt / DHTML Web 2.0 style interaction with it, and give your users that complete rich internet application experience they require, all done within the context of a report.</font></p>
Warning No formatter is installed for the format ipb