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)
Working with multiple parameters
JM Roque
<p>I have a problem running the 2 parameters of birt...</p>
<p> </p>
<p>The situation is that I will select an employee number first then selecting a date range to generate all the time in of an employee</p>
<p> </p>
<p>Here's my script</p>
<pre class="_prettyXprint _lang-">
today = new Date(); //sample database ends in May 2005
//today = new Date(); //real "today" value if not using sample database
df = new Packages.java.text.SimpleDateFormat("yyyy-MM-dd 00:00:00");
today = df.format(today);
if (params["Date Range"].value == "Custom Range"){
this.queryText = this.queryText + " where smartcomp.service.time_in between '" + params["StartDate"].value + "' and '" + params["EndDate"].value + "'";
}
else{
if (params["Date Range"].value == "Last 6 Months"){
rangeStart = DateTimeSpan.subDate(today, 0, 6, 0);
}
else if (params["Date Range"].value == "Last 12 Months"){
rangeStart = DateTimeSpan.subDate(today, 0, 12, 0);
}
else{
rangeStart = DateTimeSpan.subDate(today, 2, 0, 0);
}
rangeStart = df.format(rangeStart);
this.queryText = this.queryText + " where smartcomp.service.time_in between '" + rangeStart + "' and '" + today + "'"
}
if( params["NewParameter2"].value != "(AllEmployee)" ){
this.queryText = this.queryText + " where employee.employee_id = " + params["NewParameter2"].value
}
</pre>
<p>Generating all employee is working but when selecting a specific employee_id the error persist. "<b><span> 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 employee.employee_id = 8' at line 6"</span></b></p>
<p> </p>
<p><b><span>Please help me solve this problem... thanks a lot</span></b></p>
Find more posts tagged with
Comments
JFreeman
<p>The best way to go about this issue is to log out this.queryText at the very end of your modifying the query with script.</p>
<p> </p>
<p>Then, you can take the full query you are sending to inspect it for errors. If nothing stands out, you can run that query directly against your MySQL data base and you should be able to get a better idea about what is wrong with the query.</p>