Page 1 of 1

Filtering Timestamp with zeos and fb URGENT

Posted: 05.11.2010, 17:24
by sfxcc
I have a problme with filtering with filtered property on dataset

i do (movdate>='01-01-2010')and(movdate<='31-01-2010')

and it doesn t work

I can i solve this ?????


Thanks

Posted: 06.11.2010, 09:45
by Darkbow
That sounds as a date cast problem. Supposing you are using Dialect 3 try this code instead:

Code: Select all

(movdate>=CAST('01-01-2010' AS TIMESTAMP))
and
(movdate<=CAST('31-01-2010' AS TIMESTAMP))
If that does not work try replacing the comparison with:

Code: Select all

movdate<=(SELECT CAST('31-01-2010' AS TIMESTAMP)) FROM RDB$DATABASE)
All of this is supposing your database date format is effectively dd-mm-yyyy. If not you should change the date literals as needed.

HTH

Posted: 08.11.2010, 18:20
by sfxcc
Sorry for the misundestand and thanks any way it helped me on sql staments.
but the prob is when i use local filtering like

ztable.filter := ' (movdate>='01-01-2010')and(movdate<='31-01-2010') ';
ztable.filtered := true;

It filter but blank , parsing error maybe ...

I use a lot local filter is faster ... doesnt overload network with several queries.


Can someone help on this.

Thanks

Posted: 08.11.2010, 20:04
by guidoaerts
i think that when you set the filter progammatically, you have to put two single quotes to represent a single quote inside the string;
(Two sequential apostrophes in a quoted string denote a single character, namely an apostrophe.)
guido

Posted: 09.11.2010, 01:10
by sfxcc
Sorry misundestand again i use

filter := ' (movdate>='+QuotedStr('01-01-2010')+')and(movdate<='+QuotedStr('31-01-2010')+') ';
filtered := true;

and doesnt filter only blank ??

Posted: 09.11.2010, 14:43
by Darkbow
Are you sure the date format is correct?

On the other hand, I am unsure whether if the selected database affects the filter in Zeos somehow, but you could try to use:

Code: Select all

filter := ' (movdate>='+QuotedStr('01-01-2010')+' AS TIMESTAMP)and(movdate<='+QuotedStr('31-01-2010')+' AS TIMESTAMP) '; 
HTH

Posted: 09.11.2010, 20:17
by sfxcc
I suppose it have a bug on date ill use then the zquery query. and later try to check if i found the prob on the code.


Thanks darkbow

Posted: 10.11.2010, 23:38
by mdaems
I am unsure whether if the selected database affects the filter in Zeos somehow
It should not.
Zeos filtering is done completely clientside.
Unfortunately I'm not familiar with the exact date handling in the filter code.
Debugging TZExpression.Evaluate might help a lot.
Also, have a look at the attached documentation made by fst001.

Mark

Posted: 12.11.2010, 00:37
by sfxcc
Ok , No bug,we can only use Boolean and Integer with "and" operator. so we can do a basic filter like = <> > < but not or "and" "or" "xor" ... etc.

So is correct and documented then no problems with it.

Whould be better we can filter double,Floats with it but its ok. zExpression Is good enough.

Thank guys.

Posted: 12.11.2010, 15:42
by mdaems
sfxcc,
I think you misunderstand the functionality a little. Doesn't the ZExpression drill deeper?
So I think (movdate>='01-01-2010')and(movdate<='31-01-2010')
is spilt up in
(movdate>='01-01-2010')
and
(movdate<='31-01-2010')
Which are two boolean expressions that can be compared with 'and'.
Or am I SOOO wrong??

If I'm not, please start using one of these simple expresions (eg movdate>='01-01-2010') and then find out why it (doesn't) work.
I still thing date comparisons should work...

Mark

Posted: 13.11.2010, 13:25
by sfxcc
Ok, forgot the result is boolean.. thinking on other stuff of the project.

But i tried several ways and it didnt work.. and with zquery at first worked so .. supposed the before post. .. .

Ill try it later cause i have to finish a project for lastweek... so with zquery is workin .. it stays by now with it.

Thanks mdaems.