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 birt version as a variable
FOS
<p>Hi,</p>
<p> </p>
<p>Is there a way to get the birt engine version as a variable or parameter in the report design script code?</p>
<p> </p>
<p>Thanks,</p>
Find more posts tagged with
Comments
Clement Wong
<p><span style="font-family:'courier new', courier, monospace;">reportContext.getReportRunnable().getReportEngine().getVersion();</span><br>
</p>
<p><u>Result Examples (1st column only)</u><br><span style="font-family:'courier new', courier, monospace;">4.4.0.v20150206-1039 Commercial BIRT iHub 3.1</span></p>
<div><span style="font-family:'courier new', courier, monospace;">4.5.0.v201506092134 Open Source BIRT 4.5.0</span></div>
FOS
<p>Thanks a lot Clement!</p>
<p> </p>
<p>Good day,</p>
FOS
<p>Hi, I tried it this way:</p>
<p> </p>
<p><em>importPackage(Packages.com.ibm.tivoli.maximo.report.script);<br>
mxReportScriptContext = MXReportScriptContext.initialize(reportContext);<br>
mxReportScriptContext.setDefaultLogLevel("DEBUG");<br>
mxReportScriptContext.setDefaultLogFile("C:/temp/ITD_Change_Governance_Metrics.log");<br>
scriptLogger = mxReportScriptContext.getReportScriptLogger();</em></p>
<p> </p>
<p><em>var MiTest = new String(mxReportScriptContext.getReportRunnable().getReportEngine().getVersion());</em></p>
<p> </p>
<p>But I get the next error:</p>
<p> </p>
<p><em><span><span>var MiTest = new String(reportContext.getReportRunnable().getReportEngine().getVersion());":<br>
TypeError: Cannot find function getVersion. (/report/method[
@name="
;initialize"]#21).<br>
at org.eclipse.birt.core.script.ScriptContext.eval(ScriptContext.java:307)</span></span></em></p>
<p> </p>
<p>I tried using <em>reportContext... </em>or <em>mxReportScriptContext... </em></p>
<p> </p>
<p>BTW, I'm using version 2.3. Am I loosing some steps?</p>
<p> </p>
<p>Thanks,</p>
Clement Wong
<p>The getVersion method wasn't available in BIRT 2.3 so that is why you are getting the cannot find function getVersion error.</p>
<p> </p>
<p>With the BIRT version you are using, the closest you can get is the BIRT Engine JAR file name (and hopefully your BIRT Engine JAR filename has a version and build number associated with it):</p>
<p> </p>
<p style="margin-left:40px;"><span style="font-family:'courier new', courier, monospace;">reportContext.getReportRunnable().getReportEngine().getClass().getProtectionDomain().getCodeSource().getLocation();</span></p>
<p> </p>
<p>Example output from a BIRT 2.3.2 Designer:</p>
<p> </p>
<div style="margin-left:40px;"><span style="font-family:'courier new', courier, monospace;">file:/C:/OS_BIRT/232/eclipse/plugins/org.eclipse.birt.report.engine_2.3.2.r232_20090217.jar</span></div>
FOS
<p>It worked great, thanks a lot.</p>