Page 1 of 1
Locate a record in DBGrid
Posted: 24.04.2012, 08:36
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.
Posted: 25.04.2012, 14:16
by jeremicm
It's same as regular VCL TQuery.Locate().
Try searching in Delphi help...
http://docwiki.embarcadero.com/Librarie ... Set.Locate
Posted: 26.04.2012, 11:16
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.
Posted: 27.04.2012, 05:59
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.
Posted: 27.04.2012, 08:05
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?
Posted: 27.04.2012, 08:27
by Plavozont
Wow, it works like this:
filt:='birth_date like ''*1981''';
Posted: 28.04.2012, 19:05
by mdaems
Someone once sent me a manual with the ZExpression functionality that's also used for Filters:
Posted: 30.04.2012, 06:34
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?
Posted: 05.05.2012, 20:13
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...