error when previewing report using parameters for sql query
Posted: Mon Mar 28, 2011 8:12 pm
We are using 2011.1.917 of the flex report designer and we are trying to pass sql parameters at runtime using the following sql query for the datasource:
select * from detail where id='{id}' and date>='{startdate}' and date<='{enddate}'
Here is the copy of the flex code we are using to pass the parameters:
var mFromAmPm:int = cFrom.ampm.selectedValue as int;
var agent_id:String = "";
var mFromHours:int = cFrom.hours.value;
if (mFromHours == 12 &&mFromAmPm == 1)
{
mFromHours = 0;
}
var mFromMin:int = cFrom.minutes.value;
var mFromDate:String = MYSQLDate.format(cFrom.date.selectedDate) + " " + doubleDigitFormat(mFromHours + 12*(mFromAmPm-1)) + ":" + doubleDigitFormat(mFromMin) + ":00";
var mToAmPm:int = cTo.ampm.selectedValue as int;
var mToHours:int = cTo.hours.value;
if (mToHours == 12 &&mToAmPm == 1)
{
mToHours = 0;
}
var mToMin:int = cTo.minutes.value;
var mToDate:String = MYSQLDate.format(cTo.date.selectedDate) + " " + doubleDigitFormat(mToHours + 12*(mToAmPm-1)) + ":" + doubleDigitFormat(mToMin) + ":00";
var mAgent:Object = cAgent.selectedItem as Object;
if (mAgent != null)
{
agent_id = mAgent.data as String;
}
var agentid:StiDataParameter = vWreport.dictionary.dataSources.getByName("agentscalls").parameters.getByName("id");
if (id != null)
{
agentid.value = id;
}
var startdate:StiDataParameter = vWreport.dictionary.dataSources.getByName("agentscalls").parameters.getByName("startdate");
if (startdate != null)
{
startdate.value = mFromDate;
}
var enddate:StiDataParameter = vWreport.dictionary.dataSources.getByName("agentscalls").parameters.getByName("enddate");
if (enddate != null)
{
enddate.value = mToDate;
}
vWreport.isRendered = false;
myView.report = vWreport;
we keep getting errors when we preview the report or try to run it in the report browser that the sql query syntax is wrong. any help would be appreciated.
Thanks!
select * from detail where id='{id}' and date>='{startdate}' and date<='{enddate}'
Here is the copy of the flex code we are using to pass the parameters:
var mFromAmPm:int = cFrom.ampm.selectedValue as int;
var agent_id:String = "";
var mFromHours:int = cFrom.hours.value;
if (mFromHours == 12 &&mFromAmPm == 1)
{
mFromHours = 0;
}
var mFromMin:int = cFrom.minutes.value;
var mFromDate:String = MYSQLDate.format(cFrom.date.selectedDate) + " " + doubleDigitFormat(mFromHours + 12*(mFromAmPm-1)) + ":" + doubleDigitFormat(mFromMin) + ":00";
var mToAmPm:int = cTo.ampm.selectedValue as int;
var mToHours:int = cTo.hours.value;
if (mToHours == 12 &&mToAmPm == 1)
{
mToHours = 0;
}
var mToMin:int = cTo.minutes.value;
var mToDate:String = MYSQLDate.format(cTo.date.selectedDate) + " " + doubleDigitFormat(mToHours + 12*(mToAmPm-1)) + ":" + doubleDigitFormat(mToMin) + ":00";
var mAgent:Object = cAgent.selectedItem as Object;
if (mAgent != null)
{
agent_id = mAgent.data as String;
}
var agentid:StiDataParameter = vWreport.dictionary.dataSources.getByName("agentscalls").parameters.getByName("id");
if (id != null)
{
agentid.value = id;
}
var startdate:StiDataParameter = vWreport.dictionary.dataSources.getByName("agentscalls").parameters.getByName("startdate");
if (startdate != null)
{
startdate.value = mFromDate;
}
var enddate:StiDataParameter = vWreport.dictionary.dataSources.getByName("agentscalls").parameters.getByName("enddate");
if (enddate != null)
{
enddate.value = mToDate;
}
vWreport.isRendered = false;
myView.report = vWreport;
we keep getting errors when we preview the report or try to run it in the report browser that the sql query syntax is wrong. any help would be appreciated.
Thanks!