Filtering Timestamp with zeos and fb URGENT

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
sfxcc
Senior Boarder
Senior Boarder
Posts: 95
Joined: 13.05.2010, 18:48

Filtering Timestamp with zeos and fb URGENT

Post 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
where's the code ..
Darkbow
Fresh Boarder
Fresh Boarder
Posts: 19
Joined: 01.09.2009, 12:28

Post 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
sfxcc
Senior Boarder
Senior Boarder
Posts: 95
Joined: 13.05.2010, 18:48

Post 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
where's the code ..
guidoaerts
Senior Boarder
Senior Boarder
Posts: 93
Joined: 01.07.2009, 16:07

Post 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
sfxcc
Senior Boarder
Senior Boarder
Posts: 95
Joined: 13.05.2010, 18:48

Post 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 ??
where's the code ..
Darkbow
Fresh Boarder
Fresh Boarder
Posts: 19
Joined: 01.09.2009, 12:28

Post 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
sfxcc
Senior Boarder
Senior Boarder
Posts: 95
Joined: 13.05.2010, 18:48

Post 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
where's the code ..
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
You do not have the required permissions to view the files attached to this post.
Image
sfxcc
Senior Boarder
Senior Boarder
Posts: 95
Joined: 13.05.2010, 18:48

Post 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.
where's the code ..
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
sfxcc
Senior Boarder
Senior Boarder
Posts: 95
Joined: 13.05.2010, 18:48

Post 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.
where's the code ..
Post Reply