- Select a blank area in the report. This should display report properties in the Property Editior.
- Now click on the "Script" tab for the report displayed at the bottom of the main work area. (where Preview/Layout tabs are).
- In the script drop down, select "Before Factory" and paste the javascript code below.
TCR_IUSER = "com.ibm.tivoli.reporting.api.reportEngine.IUserInfo";
userInfo = reportContext.getAppContext().get(TCR_IUSER);
userName = "unknown";
if (userInfo != null) {
userName = userInfo.getUserPrincipal();
} - Now you can use the userName javascript variable in your reports to identify/display the TCR User.
- For example, to display the UserName, insert a "Dynamic Text" item anywhere in your report and enter the following value. "User name = " + userName
Tuesday, March 29, 2011
Passing TCR UserID in BIRT Reports
Many times, you might want to display/determine the TCR user name that is invoking the reports. While there is no GUI way of doing this within BIRT, a simple Javascript is all you need. Here is how to do it in BIRT
Great tip on using scripting in your BIRT report to get information from app context. Can you submit a link to your article on BIRT Exchange devshare (http://www.birt-exchange.org/org/devshare/) so more BIRT developers can benfit from it?
ReplyDeleteThanks for the suggestion! Just posted in BIRT-Exchange as well.
ReplyDeletehi venkat ,,,
ReplyDeletejust tried the same code in TCR2.1 /ITNM3.9 ,, but its doesn't seem to work, though it did work perfectly on TCR 1.2/Wbtop2.2 ..any clue what could be wrong ... thanks in advance
Gaurav