Page 1 of 1

error when previewing report using parameters for sql query

Posted: Mon Mar 28, 2011 8:12 pm
by Rick
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!

error when previewing report using parameters for sql query

Posted: Tue Mar 29, 2011 2:12 am
by Vladimir
Hello, Rick

We reproduced this error, we will fix it in the next builds. At this moment you can use report variables as parameters:

Code: Select all

var agentid:StiVariable = vWreport.dictionary.variables.getByName("id");
if (id != null)
{
agentid.value = id;
}

var startdate:StiVariable = vWreport.dictionary.variables.getByName("startdate");
if (startdate != null)
{
startdate.value = mFromDate;
}
This feature is available in the latest prerelease build.

Thank you.

error when previewing report using parameters for sql query

Posted: Tue Mar 29, 2011 11:48 am
by Rick
Thank you...when you say next release do you mean the one on april 1?

error when previewing report using parameters for sql query

Posted: Tue Mar 29, 2011 3:12 pm
by Andrew
Hello,

We expect the release be life this week (30th March- 1st April). We are finishing our last tests.

Thank you.