Home Analytics DevShare
The community of Analytics developers are invited to follow and participate in the developer network.
OpenText technical experts collaborate with supported customers and partners in the Magellan product area.

Workaround for Using an External JS Resource in Parameter Script Methods

mwilliamsmwilliams BIRT Guru
edited November 1, 2013 in DevShare
To access a js function defined in your report's resources, in your parameter scripts, you can use a workaround like this to read the js file, manually.
importPackage(Packages.java.io);
importPackage(Packages.java.lang);
ist = reportContext.getResource("myJSFile.js").openStream();
myjsstring="";
bytesa = new ByteArrayOutputStream();
var c;
while((c=ist.read()) != -1){
bytesa.write(c);
} 
ist.close();
data = bytesa.toByteArray();
value = new String(data);
myjsstring = reportContext.evaluate(value);
<br />
From here, you'll be able to call your function, like you would in any other script area, i.e. myFunction();

Regards,

Michael Williams

eSignLive Evangelism & Community Manager | eSignLive by VASCO
 
Find me on:
Twitter
Facebook
Blog
LinkedIn

eSignLive Developer Community
 
Email me:
Google: [email protected]

Sign In or Register to comment.