Page 1 of 1

Filter with a date range

Posted: Mon 16 May 2011 17:56
by shsit
Hello,

consider the following table:

ID DateFrom DateTo
1 6.5.2011 6.5.2011
2 7.5.2011 9.5.2011


Using a TUniQuery with ADS Database (10.10), I want to set a filter over a data range.

This filter works:

Code: Select all

      UniQuery1.Filter := 'DateFrom >= '+ QuotedStr('06.05.2011') +
                               ' AND DateTo = '+ QuotedStr('08.05.2011') +
                               ' AND DateTo <= ' + QuotedStr('08.05.2011');
      UniQuery1.Filtered := True;

Any ideas why the filter isn't working?
Thank you very much!

Posted: Tue 17 May 2011 05:40
by AndreyZ
Hello,

There are no such records in your table where DateFrom column value is bigger than 08.05.2011 . That's why with this filter you don't get any records. You can try using the following code:

Code: Select all

UniQuery1.Filter := 'DateFrom = ' + QuotedStr('06.05.2011');
UniQuery1.Filtered := True;
and

Code: Select all

UniQuery1.Filter := 'DateFrom = ' + QuotedStr('08.05.2011');
UniQuery1.Filtered := True;

Posted: Tue 17 May 2011 06:17
by shsit
Hi Andrey,
excuse me of course you are right. I guess the day yesterday was a little to long :oops:

Posted: Tue 17 May 2011 06:27
by AndreyZ
Feel free to contact us if you have any further questions about UniDAC.