Okay, so I've read the following Thread quite a few times...<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/modules/vbulletin/showthread.php?t=10071&highlight=formatListQueryParams'>http://www.birt-exchange.com/modules/vbulletin/showthread.php?t=10071&highlight=formatListQueryParams</a><br />
<br />
It doesn't seem to resolve my problem...<br />
<br />
All I want to do is pass an array of values in parameters via query string and have it work. I've been struggling with this for three weeks now with lots of googling, reading threads in this forum, and going through various tutorials.<br />
<br />
Here is what I want..<br />
<br />
1) Pass values into the BIRT report query string in the BIRT Report Viewer from an external PHP form (doesn't matter, parameters will be passed dynamically, I have that working). So, the URL would look like the following:<br />
<br />
<a class='bbc_url' href='
http://localhost:8080/birt222/frameset?__report=files/rpt_splendorataksscore.rptdesign&rp_student_id=12519,12345,13456,13456'>http://localhost:8080/birt222/frameset?__report=files/rpt_splendorataksscore.rptdesign&rp_student_id=12519,12345,13456,13456</a><br />
<br />
2) I want results ONLY for the values passed in the rp_student_id parameter.<br />
<br />
12519 | Student1<br />
12345 | Student2<br />
13456 | Student3<br />
13456 | Student4<br />
<br />
3) NOT show up the parameter select form (simple just show the results based on parameter values passed in the query string)<br />
<br />
What I have done is the following:<br />
<br />
1) In Data Set, add a query (select * from tbl_students)<br />
<br />
2) In Data Set, added the following codes in the beforeOpen Script:<br />
<br />
var whereclause = " where 0=0";<br />
var wc_plus = "";<br />
if (params["rp_student_id"].value) {<br />
var param_sid_count = params["rp_student_id"].value.length;<br />
}<br />
else {<br />
var param_sid_count = 0;<br />
}<br />
if (param_sid_count > 0) {<br />
var student_id = params["rp_student_id"].value;<br />
var param_student_id = formatListQueryParams(student_id); <br />
wc_plus = " and mahr.ei_student_id in (" + param_student_id + ")";<br />
}<br />
var sortbygroup = " group by admin_year, admin_month,taks_document_number, mahr.ei_student_id, mahr.student_first_name, mahr.student_last_name) as row_data order by row_label, admin_date desc";<br />
if (wc_plus.length > 0) {<br />
var query = this.queryText + whereclause + wc_plus;<br />
}<br />
else {<br />
var query = this.queryText + whereclause;<br />
} <br />
this.queryText = query + sortbygroup;<br />
<br />
3) Added the following in the Report "initialize" section:<br />
<br />
function formatListQueryParams(paramsArray) {<br />
var queryStr="";<br />
// create the correct syntax for an Oracle "in" clause <br />
// example: 'Eric', 'David', 'Chris', 'Aaron'<br />
for (var index = 0; index < paramsArray.length; index++) {<br />
queryStr = queryStr.concat("'" + paramsArray[index] + "',");<br />
}<br />
// chop off the trailing comma<br />
queryStr = queryStr.substr(0, queryStr.length - 1);<br />
return queryStr;<br />
}<br />
<br />
4) Added a Report Parameter called "rp_student_id":<br />
<br />
Alignment: auto<br />
Conceal Value: false<br />
Control type: text-box<br />
Data type: string<br />
Is Required: false<br />
Hidden: true<br />
Distinct: true<br />
Scalar parameter type: simple<br />
Value type: static<br />
<br />
Result:<br />
<br />
The report runs and gives complete result set if no params are passed. If I pass the "rp_student_id" parameter, no results are given.<br />
<br />
Nothing in the /webapps/birt/logs files. Nothing in /birt/logs/catalina.out<br />
<br />
What gives?<br />
<br />
When will BIRT allow multiple values in Data Set Parameters more fluidly, meaning, you add a Data Set param by the following:<br />
<br />
1) Query =<br />
<br />
column in (?)<br />
<br />
2) Parameter param_colum<br />
<br />
Done!