Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Script in data source with BIRT 2.3.1
loume
Hi,
I had design a report use BIRT 2.3.0 and this report have three data set
data set a is the main data to show with table
data set b and c is use with report parameter
but b parameter I need use permission control
so I code script in the data soruce in beforeOpen to get some information with url
and set this information with golobalVariable
than in b data set will use this golobalVariable to check permission
this script control in 2.3.0 is worked.
but I upgrade to 2.3.1 and this script control is failed and have errors
Is anyone can give me suggestion??
thx
Find more posts tagged with
Comments
mwilliams
Hi loume,
Can you post the errors in here? Please be sure to expand the errors. Thanks.
loume
Hi,
script in data sorce beforeopen is
var l_report_id = reportContext.getHttpServletRequest().getParameter("p_report_id");
reportContext.setGlobalVariable("p_report_id", l_report_id);
data set sql is
select report_name
from report_table
where report_id = ?
and this data set have one parameter is
l_report_id and it default value is eval("reportContext.getGlobalVariable('p_report_id');");
this is get p_report_id from url and set to golobal value and in data set get this value to use in sql
the errors log please see attachment, thx
mwilliams
loume,
Is there any way you can set something similar up with the sample database? That way I can see more clearly what your setup is?
loume
mwilliams,<br />
<br />
hi, please see the attach files, that I use cascade report sample edit to I use the report<br />
<br />
test this report use <br />
<a class='bbc_url' href='
http://localhost:8080/birt/run?__report=/report/cascade.rptdesign&p_perm=1'>http://localhost:8080/birt/run?__report=/report/cascade.rptdesign&p_perm=1</a><br
/>
<br />
p_perm is 1~4 that will change customer list<br />
<br />
thx
loume
Hello,
Is there have anyone can give me suggestion about my question??
Thx a lot.
about my post sample report, I add parameter P_PERM in customers data set, and this parameter direction set Input
and Default value set the l_p value, and in customers data set will use this value to get different data.
duffy
Hi loume,
i think the problem is that the parameter in Customer dataset is not evaluated because order of firing events.
You can try the following:
remove parameter p_perm from customer dataset and the Questionmark in the Query. Remove script from Datasource 'beforeOpen' event.
Insert following script in beforeOpen event on Dataset Customer
var l_perm = reportContext.getHttpServletRequest().getParameter("p_perm");
if(l_perm == 1)
var lp = 120;
else if(l_perm == 2)
var lp = 300;
else if(l_perm == 3)
var lp = 400;
else
var lp = 1000;
this.queryText = this.queryText + " " + lp;
This will achieve the desired result.
Hope this helps,
Andreas
loume
Duffy
thx a lot,
I had try to use this function, and it can be success for my report,
thx for your help.