Workaround for Using an External JS Resource in Parameter Script Methods

mwilliamsmwilliams BIRT Guru
edited November 2013 in DevShare Downloads
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);


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.