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)
Passing parameter to scripted data source
sesker
Help!
I have integrated Birt into our application, but the problem is I can't seem to understand how to pass parameters to a scripted datasource.
I have the following code in the report execute (the engine load and starts fine):
task = engine.createRunAndRenderTanks(...);
Map<String,Object> parameters = new HashMap<String, Object>();
parameters.put("guid", trendWidget.getTrendId());
parameters.put("start", start);
parameters.put("end", end);
task.setParameterValues(parameters);
task.validateParameters();
...
in my scripted data source, I thought I could do the following:
var guid = params["guid"]
var startDate = params["start"]
var endDate = params["end"]
data = trendWidget.getReportData(guid, start, end);
...but I get an exception that start/end etc is not defined (A reference error).
I have tried:
var trendWidget = ...get my java class.
var guid = params["guid"].value
var startDate = params["start"].value
var endDate = params["end"].value
data = trendWidget.getReportData(guid, start, end);
...save result.
I even created input parameters in the properties of the data source to match...nothing I do seems to work.
What am I doing wrong? I just want to pass three arguments to the script engine to in turn pass back to my java object...
Scott
Find more posts tagged with
Comments
Ashwind
An alternate would be
reportContext.setPersistentGlobalVariable("guid", trendWidget.getTrendId());...
and use get to getPersistentGlobalVariable() the corresponding value.