Locate a record in DBGrid

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

Moderators: gto, bravecobra

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

Locate a record in DBGrid

Postby Plavozont » 24.04.2012, 08:36

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:

Postby jeremicm » 25.04.2012, 14:16

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

Postby Plavozont » 26.04.2012, 11:16

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

Postby Plavozont » 27.04.2012, 05:59

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

Postby Plavozont » 27.04.2012, 08:05

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

Postby Plavozont » 27.04.2012, 08:27

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:

Postby mdaems » 28.04.2012, 19:05

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

Postby Plavozont » 30.04.2012, 06:34

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:

Postby mdaems » 05.05.2012, 20:13

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


Return to “Documentations”

Who is online

Users browsing this forum: No registered users and 1 guest