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)
How to pass a parameter to myeclipse report ?
Prasads
Hi all..
I am a new bee in handling reports. I am trying to generate a simple web reort using Myeclipse reports facility. Though i have read couple of tutorials and tried generating the report, i am not able to pass a simple parameter to the report.
I have designed a simple report with a table containing 2 columns. I bind the dataset to the columns properly. When i run my application it works fine. But
when i try passing some parameter from a JSP page it is not working.
I want to execute the query accordingly say :
select id,output from engine where username= ?
I have tried setting the report param and dataset param for the same. But don't know how exactly to do this.
Can some one enlist the steps ?
Thanks in advance..
Find more posts tagged with
Comments
mwilliams
Hi Prasads,
So, you're wanting to know how to link a report parameter and a dataSet parameter? Or something else? Let me know.
Prasads
Hi Michael..
Thanks for your reply..
I have linked my dataset param to report param and it is working fine for me.
I am trying to pass a parameter from the JSP. I have appended the param as a query string like :
<a href="<%= path + "/frameset?__report=reports/dyna_all_report.rptdesign&__format=HTML&UserParam="+users%>">View Report (reports/dyna_report.rptdesign)</a>
The name of the param in JSP and name of report param are same(UserParam here). With this i am able to pass the parameter from my JSP.
Is this approach ok to work with ?
Also if i want to pass a String array to report as a parameter how it can be done as my query is going to be :
select name,output,time from engineslog where name in (?)
The ? is likely to be string values like ('prasad','michael')..
Thanks..
mwilliams
Prasads,
From the looks of it, that should work. Are you having any issues with passing the array of strings? Or does it work as expected?
Prasads
Hi Michael..
As already explained, i am able to pass a single param from JSP.
But when i try passing String array to report it wont work at all and blank report gets displayed when i run my application.
I am appending the string array as my query string but dont know how to
handle things at report side as i was doing in case of a single string param.
The problem before me is how to pass a string array from JSP as my query is
going to be :
select username,output,time from engines where username in (?)
? here will be ('prasad','michael') likewise.
Do you have any solution ??
Thanks..
Prasad
mwilliams
Prasads,<br />
<br />
If it's an actual array you're passing in, you may need to split it up and build the where clause on your own in the dataSet script similar to the following example:<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/devshare/designing-birt-reports/688-using-a-multivalue-parameter-in-an-in-clause/#description'>Using
a multivalue parameter in an in clause - Designs & Code - BIRT Exchange</a><br />
<br />
Let me know if this works.
Prasads
Hey Michael,
I have referred the link posted by you. I have tried implementing the same but still the problem is there.
When i split the array in beforeOpen as suggested by you it gives me SQL exception as :
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where userName in (a,a,i,1)' at line 3
Actually i am passing string array which contains values like ('aai1','aai2').
How it is taking it like (a,a,a,1) ? I am really confused.
Can you suggest some simple example to go through ? I am a new bee and still struggling with reports.
Thanks..
Prasad
mwilliams
Prasad,
Can you attach your report design, so I can see what all you've done? Also, let me know what version of BIRT you're using so I can open the report in the correct version. Thanks.
Prasads
Hi Michael..
This is the design of report i am struggling with..The BIRT version i am using is
2.3.1 (in MyEclipse IDE). Please have a look and let me know the loopholes..
Thanks..
Prasad
mwilliams
Prasad,
How exactly is your parameter coming in? Is it like "('aai1','aai2')"? Or is it like "'aai1','aai2'"? Also, it seems that your parameter is just a string, not an array of strings, because your calling of param["paramName"][1] just give you the first letter, not the first string. Depending on how exactly your parameter looks when it comes in, you may not have to do as much script work.