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)
Way to pass parameter to report query
ashokkumar84k
<p>Hi,</p>
<p> </p>
<p>I have done the following,</p>
<p> </p>
<p>1. Created a rptdesign file and configured Data source and data set.</p>
<p>2. The Data set query contains where condition, there I'm passing start date and end date.</p>
<p>EX: SELECT COUNT(*) AS NUMBER_OF_REQUESTS, DATEPART(MONTH, STARTTIME) AS MON FROM SRCH_LOG </p>
<div>WHERE START_DATE = <strong>?</strong> AND END_DATE = <strong>?</strong> GROUP BY DATEPART(MONTH, STARTTIME)</div>
<p> </p>
<p>What are the ways to pass these Start date and End date from java/jsp to report design which i configured for generating report and how?</p>
<p> </p>
<p>It'll be very helpful if you reply fast.</p>
<p> </p>
<p>Thanks,</p>
<p>Ashok</p>
<p> </p>
<p> </p>
<p> </p>
Find more posts tagged with
Comments
svirfneblyn
<p>Hi! send it from servlet . try something like this:</p>
<p> </p>
<div> </div>
<pre class="_prettyXprint">
IRunAndRenderTask task = engine.createRunAndRenderTask(reportDoc);
task.setParameterValue("END_DATE",(objectMap.get("END_DATE")));</pre>
<p>where objectMap contain your parameters.</p>
<p> </p>
<p>add script in "beforeOpen"</p>
<pre class="_prettyXprint">
this.queryText= this.queryText.replace('?', params["END_DATE"].value);</pre>
MadhuriKankurte
<p>Can I change the whole query ..not just the params from java ??</p>
malaythecool
<p>you can refer to this link</p>
<p><a data-ipb='nomediaparse' href='
http://help.eclipse.org/mars/index.jsp?topic=/org.eclipse.birt.doc/birt/rp-HowToDefineADataSetParameter.html'>http://help.eclipse.org/mars/index.jsp?topic=/org.eclipse.birt.doc/birt/rp-HowToDefineADataSetParameter.html</a></p>
;
<p> </p>
<p>Malay</p>
malaythecool
<p>you can refer following for java</p>
<pre class="_prettyXprint">
public List executeQuery( String query) throws IOException{
QueryRequest queryInfo = new QueryRequest().setQuery(query);
Bigquery.Jobs.Query queryRequest = bigquery.jobs().query("yourprojectid", queryInfo);
QueryResponse queryResponse = queryRequest.execute();
return queryResponse.getRows();
}
</pre>