Locate a record in DBGrid

All about the Doxygen documentation for Zeoslib.
Links to the downloads and online version.

Moderators: gto, bravecobra

Post Reply
Plavozont
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 06.01.2012, 11:22

Locate a record in DBGrid

Post by Plavozont »

I couldn't find the documentation on ZeosLib anyhere. The links in the topic "New documentation subproject started" are bad. I use ZeosDBO in Delphi. I have DBGrid connected to DataSet connected to ZQuery connected to ZConnection connected to SQLite3. I need to set cursor in DBGrid to specific record with specific name and date of birth for example. In TTable, there is a function Table1.FindNearest('text'), that allows to do that. But I don't know such function in ZQuery. ZQuery1.FindFirst seems to look for the files ZQuery1.Locate - for the options, ZQuery1.Lookup - I don't get what it is, I don't have the manual.
Last edited by Plavozont on 28.04.2012, 16:52, edited 1 time in total.
jeremicm
Senior Boarder
Senior Boarder
Posts: 61
Joined: 18.10.2006, 17:07
Contact:

Post by jeremicm »

It's same as regular VCL TQuery.Locate().
Try searching in Delphi help...

http://docwiki.embarcadero.com/Librarie ... Set.Locate
Plavozont
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 06.01.2012, 11:22

Post by Plavozont »

I would like some manual on ZeosDBO/ZeosLib please.
I have found some sort of a way to do what I want, I use ZQuery1.filter. But I have trobles filtering date field. In ZQuery1.SQL I have something like this:

SELECT ...( (case birth_d when 1 then '--' else strftime("%d", birth_date) end) || '.' || (case birth_m when 1 then '--' else strftime('%m', birth_date) end) || '.' || (case birth_y when 1 then '----' else strftime('%Y', birth_date) end) ) as birth_date...

Then I filter:

filt:='birth_date = "1981-07-23";//like this
filt:='birth_date = "23.07.1981";//or like this

Form1.ZQuery1.Filter:=filt;
Form1.ZQuery1.Filtered:=true;

My DBGrid fills with nothing.

When I filter like this:
filt:='birth_date = "--.--.1981";
Zeos says "--.--.1981" - is a bad date.
According to SELECT statement its not a date its a concatinated string.
Plavozont
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 06.01.2012, 11:22

Post by Plavozont »

I figured that when filter looks like this:
filt:='birth_date = "--.--.1981";
Zeos says "--.--.1981" - is a bad date.
But when it looks like this:
filt:='birth_date = "--;--;1981";
Or even like this:
filt:='birth_date = "Simon Smith";
It says nothing, but still I can't filter anything even with dates that look normaly.

P.S. My "Name" field filters just fine.

P.S.S. Manual says something about asterisk in filter, it doesn't work, not for me, not for birth_date, not for the name.
Last edited by Plavozont on 27.04.2012, 08:27, edited 1 time in total.
Plavozont
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 06.01.2012, 11:22

Post by Plavozont »

OK, that's ZeosDBO 7.0.0 bug, ZeosDBO 6.6.6 filters just fine, it doesn't even complain about "--.--.1981". But asterisks(or percent signs) still give no effect, any manual there?
Plavozont
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 06.01.2012, 11:22

Post by Plavozont »

Wow, it works like this:
filt:='birth_date like ''*1981''';
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Someone once sent me a manual with the ZExpression functionality that's also used for Filters:
You do not have the required permissions to view the files attached to this post.
Image
Plavozont
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 06.01.2012, 11:22

Post by Plavozont »

That's great! Thank you!!! Why don't you create a sticky post and put it there so that every one could use it :) :?: :!: By the way, what happend to all the other documentations?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

What 'all the other documentations' are you talking about exactly?
Apart from the knowledge base and the source documentation that's packaged when a release is made there's not that much available as far as I know...
Image
Post Reply