Ok I have this situation :
my deliveryDate is "2014-08-08" and my ConfirmedDlv is "2014-08-10".
My report has to extract all the purchlines with ConfirmedDlv ( or deliveryDate if the ConfirmedDlv is null ) between fromdate and todate.
if i use
this.query().dataSourceTable(tablenum(purchLine)).addRange(fieldnum(purchLine, deliveryDate)).value(queryRange(FromDate.value(), toDate.value()));
this.query().dataSourceTable(tablenum(purchLine)).addRange(fieldnum(purchLine, ConfirmedDlv)).value(queryRange(FromDate.value(), toDate.value()));
and fromdate = "2014-08-09" and todate = "2014-08-11" the report is empty.
In the original report the query was only
this.query().dataSourceTable(tablenum(purchLine)).addRange(fieldnum(purchLine, deliveryDate)).value(queryRange(FromDate.value(), toDate.value()));
I have to add a test on ConfirmedDlv, so my sql query has to be :
select * from purchline where (ConfirmedDlv >= Fromdate and ConfirmedDlv <= Todate) or ( deliveryDate >= Fromdate and deliveryDate <= Todate and ConfirmedDlv = '1900-01-01').
If i use the syntax this.query()...... it seems to keep the filter. If i use
QueryBuildDataSource qbds;
queryBuildRange qbr;
query q1;
q1 = new Query();
qbds = q1.addDataSource(tableNum(PurchLine));
bds.addRange(fieldNum(PurchLine, DeliveryDate)).value(queryRange(9\8\2014, 10\8\2014));
qbds.addRange(fieldNum(PurchLine,CONFIRMEDDLV)).value(queryRange(9\8\2014, 10\8\2014));
info(qbds.toString());
the info give my the right filter but the report extracts all the purchlines in the table so that it seems the filter is ignored. The datasource in the report is PurchTable in join with Purchline.
Thank you for your answer.