how to pass multiple values to a single report parameter
Options
I am having a Date type report parameter and passing its value into dataset sql query 'select.....from.....where date=?' But now i want to pass multiple values for this single report parameter into above query...plz suggest me any solution for it..
0
Comments
-
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="82179" data-time="1314824186" data-date="31 August 2011 - 01:56 PM"><p>
Are you using a textbox parameter and having the dates entered with a comma separator? Or are you having a multi-select parameter where the user selects multiple dates from a listbox?<br /></p></blockquote>0 -
I am having a multi-select parameter where the user selects multiple dates from a listbox. Its working fine but i dont know how to pass values of this multi select parameter in IRunAndRenderTask task.
When i am taking single value parameter then m passing its value like IRunAndRenderTask task.setParameterValue("tdDate", paramValue2);
But now, in the case of multi value parameter, how to pass multiple values in task.setParameterValue("tdDate",........)
Plz help me0 -
<blockquote class='ipsBlockquote' data-author="'delta123'" data-cid="82189" data-time="1314851472" data-date="31 August 2011 - 09:31 PM"><p>
I am having a multi-select parameter where the user selects multiple dates from a listbox. Its working fine but i dont know how to pass values of this multi select parameter in IRunAndRenderTask task. <br />
When i am taking single value parameter then m passing its value like IRunAndRenderTask task.setParameterValue("tdDate", paramValue2);<br />
But now, in the case of multi value parameter, how to pass multiple values in task.setParameterValue("tdDate",........)<br />
Plz help me<br /></p></blockquote>0 -
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="82394" data-time="1315423187" data-date="07 September 2011 - 12:19 PM"><p>
Sorry for the delay, glad you found a solution. Let us know whenever you have questions! <br /></p></blockquote>
<br />
<br />
Hello, I am having the same trouble but with entering multiple values into a textbox parameter. Can you provide a solution? My parameter works perfectly but only with one value.0 -
I didn't open it up, but I believe this example shows how to enter multiple values into a text box and then uses them in the query. Let me know.
http://www.birt-exchange.org/org/devshare/designing-birt-reports/338-birt-parameters--using-in-clause/Warning No formatter is installed for the format ipb0 -
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="95227" data-time="1328738759" data-date="08 February 2012 - 03:05 PM"><p>
I didn't open it up, but I believe this example shows how to enter multiple values into a text box and then uses them in the query. Let me know.<br />
<br />
<a class='bbc_url' href='http://www.birt-exchange.org/org/devshare/designing-birt-reports/338-birt-parameters--using-in-clause/'>http://www.birt-exchange.org/org/devshare/designing-birt-reports/338-birt-parameters--using-in-clause/</a><br /></p></blockquote>
<br />
current problem. This code is giving me an error message that it isn't ended properly. But why?<br />
<br />
where<br />
(a.status = 'Replaced' or<br />
a.status = 'Warranty') and<br />
a.serialno IN ('MS:param_1') ?<br />
<br />
Also, can you tell me what the MS stands for? I admit I am using that piece of the code blindly.0 -
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="95449" data-time="1328803125" data-date="09 February 2012 - 08:58 AM"><p>
Can you create a sample report, using the sample database, that shows me what you're doing? Thanks!<br /></p></blockquote>
<br />
As you were writing that answer above I was modifying my question to the current problem. Does the code I provided help? Select is just typical columns from 'a' database. The code works perfectly fine except when I try to add the in clause. Here's a sample from the classic models database:<br />
select products<br />
from classicmodels<br />
where CLASSICMODELS.PRODUCTS = classicmodels.products in ('MS:Parameter_1') and classicmodels.products in ('MS:NewParameter'))<br />
<br />
(I can not test it because the classicmodels appears to be disabled).<br />
<br />
Here is an error message I am getting for my regular report:<br />
<br />
Failed to prepare the query execution for the dataset: Data Set<br />
Cannot set the string value(%) to parameter1<br />
Cannot set preparedStatement paramenter string value<br />
SQL error #1: Invalid column index0 -
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="95547" data-time="1328820480" data-date="09 February 2012 - 01:48 PM"><p>
Are you not using the way from the example in the download? Are you using scottr's way? I'm guessing MS = multi-select just by looking at it. Let me know on which way you're trying to do this.<br /></p></blockquote>
<br />
I couldn't download his file so that it came out readable for some reason, so I went to the link provided by one of his commenters instead and followed that example: <br />
<a class='bbc_url' href='http://birtworld.blogspot.com/2009/03/birt-multi-select-statements.html.'>http://birtworld.blogspot.com/2009/03/birt-multi-select-statements.html.</a><br />
<br />
He said creating a multiple input parameter for a text box was a simple two step process. 1) modify your code with <br />
<br />
select status <br />
from orders<br />
where status in ('MS:pStatus') and<br />
state in ('MS:pState')<br />
<br />
<br />
2) and then add to the the script section of birt:<br />
<br />
this.queryText = BlackboardFunctions<br />
.MultiSelectSql(this.queryText, reportContext);<br />
<br />
so I modified my workable single value textbox parameter report to include the one parameter I want to be multiple to:<br />
<br />
select serialno<br />
from asset<br />
where serialno in (MS:paramater1') <br />
<br />
and the script to read<br />
<br />
this.queryText = BlackboardFunctions<br />
.MultiSelectSql(this.queryText, reportContext);<br />
<br />
<br />
I may not be understanding this correctly. Thank you for your patience and your help. I am quite a newbie!0 -
<blockquote class='ipsBlockquote' data-author="'dishatto'" data-cid="95703" data-time="1328889683" data-date="10 February 2012 - 09:01 AM"><p>
I couldn't download his file so that it came out readable for some reason, so I went to the link provided by one of his commenters instead and followed that example: <br />
<a class='bbc_url' href='http://birtworld.blogspot.com/2009/03/birt-multi-select-statements.html.'>http://birtworld.blogspot.com/2009/03/birt-multi-select-statements.html.</a><br />
<br />
He said creating a multiple input parameter for a text box was a simple two step process. 1) modify your code with <br />
<br />
select status <br />
from orders<br />
where status in ('MS:pStatus') and<br />
state in ('MS:pState')<br />
<br />
<br />
2) and then add to the the script section of birt:<br />
<br />
this.queryText = BlackboardFunctions<br />
.MultiSelectSql(this.queryText, reportContext);<br />
<br />
so I modified my workable single value textbox parameter report to include the one parameter I want to be multiple to:<br />
<br />
select serialno<br />
from asset<br />
where serialno in (MS:paramater1') <br />
<br />
and the script to read<br />
<br />
this.queryText = BlackboardFunctions<br />
.MultiSelectSql(this.queryText, reportContext);<br />
<br />
<br />
I may not be understanding this correctly. Thank you for your patience and your help. I am quite a newbie!<br /></p></blockquote>
<br />
Are you talking about a multiselect parameter? (Where you can highlight multiple selections)<br />
<br />
Or are you talking about one single textbox where they enter something like 'a, b, c' etc.<br />
<br />
Could you give a sample of what they are entering into the parameter?<br />
<br />
Thanks.0 -
Tubal - His original question was about entering values in a text box.
dishatto - I'll try to look at the example I linked to you. If it doesn't work, I'll make one for you. What is your BIRT version?Warning No formatter is installed for the format ipb0 -
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="95710" data-time="1328897040" data-date="10 February 2012 - 11:04 AM"><p>
Tubal - His original question was about entering values in a text box.<br />
<br />
dishatto - I'll try to look at the example I linked to you. If it doesn't work, I'll make one for you. What is your BIRT version?<br /></p></blockquote>
<br />
version is 2.5.2. Thanks for your help- it's very much appreciated.0 -
<blockquote class='ipsBlockquote' data-author="'Tubal'" data-cid="95708" data-time="1328891426" data-date="10 February 2012 - 09:30 AM"><p>
Are you talking about a multiselect parameter? (Where you can highlight multiple selections)<br />
<br />
Or are you talking about one single textbox where they enter something like 'a, b, c' etc.<br />
<br />
Could you give a sample of what they are entering into the parameter?<br />
<br />
Thanks.<br /></p></blockquote>
<br />
Hi Tubal, thanks for your interest. No I am not creating a multiselection report but one where the user can search a single field in a database by putting multiple values into a single textbox. They would be entering for example 10 serial numbers. Right now they can only enter one at a time, but they need a report where they can enter several serial numbers at once. <br />
<br />
Perhaps there is another way to do this other than through a parameter. Someone told me you can have the user attach a file to the report and have the report search the database for the values, but I have not figured out how birt works in this way.0 -
This is for BIRT 3.7.1. I'm not sure if 2.5.2 has the same functionality.<br />
<br />
In your dataset query, do something like this (or whatever your query requires. The important thing is to have /**serialno**/ where the where statement would normally go. We are going to replace this with a script.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>select *
from table
/**serialno**/</pre>
<br />
Now, in the beforeOpen event of your dataSet, do this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>this.queryText = this.queryText.replace("/**serialno**/", "WHERE serialno IN (" + params["serialno"].value + ")");
</pre>
<br />
Basically, in that script, you're replacing /**serialno**/ in your query with "WHERE serialno IN ( <whatever the user enters>)"<br />
<br />
This is assuming that the user enters a comma delimited list. You may need to do some cleanup of their text before you replace it if you have problems.0 -
<blockquote class='ipsBlockquote' data-author="'Tubal'" data-cid="95732" data-time="1328919138" data-date="10 February 2012 - 05:12 PM"><p>
This is for BIRT 3.7.1. I'm not sure if 2.5.2 has the same functionality.<br />
<br />
In your dataset query, do something like this (or whatever your query requires. The important thing is to have /**serialno**/ where the where statement would normally go. We are going to replace this with a script.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>select *
from table
/**serialno**/</pre>
<br />
Now, in the beforeOpen event of your dataSet, do this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>this.queryText = this.queryText.replace("/**serialno**/", "WHERE serialno IN (" + params["serialno"].value + ")");
</pre>
<br />
Basically, in that script, you're replacing /**serialno**/ in your query with "WHERE serialno IN ( <whatever the user enters>)"<br />
<br />
This is assuming that the user enters a comma delimited list. You may need to do some cleanup of their text before you replace it if you have problems.<br /></p></blockquote>
<br />
<br />
Hi Tubal,<br />
<br />
Thank you for your help. I am not sure I understand what to do correctly so thank you for your patience. I am very new to this. I just tried your method and received an error message. <br />
<br />
Here is exactly what I have done:<br />
<br />
SELECT column1, column2, colum3, serialno<br />
from table1, <br />
inner join table2<br />
on<br />
table1.commonfield = table2.commonfield<br />
where<br />
table1.serialno like ? and <br />
(table1.status = 'RBW' or <br />
table1.status = 'WR')<br />
order by table1.serialno<br />
<br />
Then in the script before open section I put what you told me to put in:<br />
this.queryText = this.queryText.replace("/**serialno**/", "WHERE serialno IN (" + params["serialno"].value + ")");<br />
<br />
And recieved this error message: + missing ) after argument list (<inline>#1)<br />
<br />
So I modified the code in the beforeopen script text to include the the actual name of the parameter('NewParameter') and changed this part of your code: "/**serialno**" for simply "?"<br />
<br />
this.queryText = this.queryText.replace("?", "WHERE serialno IN (" + NewParameter["serialno"].value + ")");<br />
<br />
I recieved the same error message for the second try.<br />
<br />
Can you tell me what I am doing wrong?0 -
Change this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>SELECT column1, column2, colum3, serialno
from table1,
inner join table2
on
table1.commonfield = table2.commonfield
where
table1.serialno like ? and
(table1.status = 'RBW' or
table1.status = 'WR')
order by table1.serialno</pre>
<br />
To this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>SELECT column1, column2, colum3, serialno
from table1,
inner join table2
on
table1.commonfield = table2.commonfield
where
/**serialno**/
(table1.status = 'RBW' or
table1.status = 'WR')
order by table1.serialno</pre>
<br />
Then in your beforeOpen script, put this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>this.queryText = this.queryText.replace("/**serialno**/", "table1.serialno IN (" + params["serialno"].value + ") and ");</pre>
<br />
This is assuming that your parameter is called 'serialno'.<br />
<br />
What we are doing is bypassing the whole ? in the query stuff, and just "manually" putting that part of our where clause in there. So we're replacing the "/**serialno**/" in your query with "table1.serialno IN (bla, bla, bla) and " before your query gets to your database.<br />
<br />
Since you have multiple serial #'s you are trying to match, you can't use LIKE because that only compares 1 to 1. You would use IN(x, x, x, x) to find matches with anything in your IN parentheses.<br />
<br />
So after your beforeOpen script runs, your query will look like this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>SELECT column1, column2, colum3, serialno
from table1,
inner join table2
on
table1.commonfield = table2.commonfield
where
table1.serialno IN (bla, bla, bla) and
(table1.status = 'RBW' or
table1.status = 'WR')
order by table1.serialno</pre>
<br />
If your serial numbers are stored as text and not numbers, you will need to use javascript to do some modification in your beforeOpen script to get quotes around each serial number. It would need to look like "table1.serialno IN ('bla', 'bla', 'bla') and " in your query.0
Categories
- All Categories
- 111 Developer Announcements
- 49 Articles
- 102 General Questions
- 123 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 898 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 124 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 1 XM Fax