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)
Get Environnment variable from BIRT in Javascript
millvall
Hi,
Does anyone have the Javascript code to get an environment variable from within a BIRT report? From say the initialize or beforeFactory event. I need to retrieve some items from env vars.
Thank You.
Milt.
Find more posts tagged with
Comments
johnw
Packages.java.lang.System.getenv();
You will need to iterate over the hashmap it provides. If you need an example, in Eclipse, go to Window/Show view/Other/Report and Chart Design/Report Examples, and open the Report Feature Examples/Scripting/Retrieve Session Information/Application_session_integrationBF.rptdesign. You can replace the HttpRequest session code with the System.getenv() call.
John
millvall
<blockquote class='ipsBlockquote' data-author="'johnw'" data-cid="68681" data-time="1285199620" data-date="22 September 2010 - 04:53 PM"><p>
Packages.java.lang.System.getenv();<br />
<br />
You will need to iterate over the hashmap it provides. If you need an example, in Eclipse, go to Window/Show view/Other/Report and Chart Design/Report Examples, and open the Report Feature Examples/Scripting/Retrieve Session Information/Application_session_integrationBF.rptdesign. You can replace the HttpRequest session code with the System.getenv() call.<br />
<br />
John<br /></p></blockquote>
<br />
<br />
Thanks John. <br />
Here's what worked for me. OnCreate in a DTC:<br />
<br />
// importPackage(Packages.java.lang.*); // OK but not needed in designer<br />
// importPackage(Packages.java.lang.System); // No good. Causes error.<br />
<br />
r = java.lang.System.getenv("PATH");<br />
this.text = r;<br />
<br />
Also, I didn't know about the samples in: Window/Show view/Other/Report and Chart Design...<br />
Thanks for that tip.<br />
<br />
Milton.