Recent

Author Topic: (SOLVED) dbf.filter property question  (Read 19660 times)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: (SOLVED - almost) dbf.filter property question
« Reply #15 on: December 19, 2013, 05:15:57 pm »
Well, you will still need to surround the field with quotes and double up any quotes inside, Engkin's solution should be sufficient:
Code: [Select]
Filter := FieldComboBox.Text + '=' + QuotedStr(DBLookupcomboBox1.Text);
... or you can force your users not to use ' characters in their database records, see how they like that ;)

Also note that that fix is for current FPC trunk and will not appear in a 2.6.x release unless it is backported. Probably too late for FPC2.6.4
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: (SOLVED - almost) dbf.filter property question
« Reply #16 on: December 19, 2013, 05:51:23 pm »
So once the above bug is fixed does that mean all this quote checking will be unnecessary ?
Your wish is my command as long as you're using FPC trunk ;)
http://svn.freepascal.org/cgi-bin/viewvc.cgi?view=revision&revision=26253
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

bill0287

  • Full Member
  • ***
  • Posts: 146
Re: (SOLVED - almost) dbf.filter property question
« Reply #17 on: December 19, 2013, 08:42:47 pm »
I used fpcup and downloaded the latest trunk. quick test showed it worked for:

1. No quotes
2. Double quotes

Did not work for

1. single quotes

Unless I misunderstood what you meant...which is very possible.

attached project I used, with this line of code:

Code: [Select]
  DBf1.Filter := 'LAST=' + QuotedStr(DBLookupcomboBox1.Text);
  DBF1.Filtered:= true;   
« Last Edit: December 19, 2013, 09:08:58 pm by bill0287 »

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: (SOLVED - almost) dbf.filter property question
« Reply #18 on: December 20, 2013, 12:59:25 pm »
Laz trunk r43509 FPC x64 r26253 Windows
Works just fine for me:
1. I add a surname 'Tiny' Thompson
2. The combobox lets me filter on that
3. It shows 'Tiny' Thompson
??!?
Perhaps you could explain the problem again, as I might be the one misunderstanding...

Attached zip with
- dbf containing friend thompson
- fix for having dbf in current application directory instead of hardwired to a certain directory
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

bill0287

  • Full Member
  • ***
  • Posts: 146
Re: (SOLVED - almost) dbf.filter property question
« Reply #19 on: December 20, 2013, 05:34:19 pm »
This file didn't work for me, but I highly doubt if it's you...I'm sure it's me. 

I am not sure I have the right trunk...how can I tell?

I only have fpcup...so if I run fpcup_update will that give me the the latest trunk or not?  If so, I can download again and test.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: (SOLVED - almost) dbf.filter property question
« Reply #20 on: December 21, 2013, 09:35:02 am »
Ah, I'm going to get rid of some frustrations here... Don't hesitate to post if you hit problems though... though perhaps best on the fpcup thread in 3rd party announcements or a new thread as this is no longer about dbf filtering...

I am not sure I have the right trunk...how can I tell?
FPC has only one trunk, not more.
try
Code: [Select]
svn info c:\development\fpc. If it spits info about an url other than trunk (e.g. the fixes 2.6 branch) it's not trunk.

See also http://svnbook.red-bean.com/en/1.7/svn-book.html

I only have fpcup...so if I run fpcup_update will that give me the the latest trunk or not?  If so, I can download again and test.
It depends on how you had set it up. It won't magically give you something else suddenly (or if it does please report a bug). By all means, please *don't* read fpcup -h, the fpcup readme, wiki pages (https://bitbucket.org/reiniero/fpcup/wiki/Home, http://wiki.lazarus.freepascal.org/fpcup), fpcup.html, Readme.txt.... </sarcasm>


Easiest to explain (but by heart, air code warning etc):
1. remove entire c:\development dir+subdirs
2. remove fpcup_update, lazarus_fpcup shortcuts from your desktop
3. fpcup --fpcurl=trunk --fpcdir=c:\development\fpctrunk
rem yes, see fpcup -h | more and fpcup.ini for more details about what this does. While real men use command line arguments like above, I prefer ini files - see the Lazarus fpcup wiki page for examples but... I digress.
4. Coffee/tea/beverage of choice.
5. Try again
« Last Edit: December 21, 2013, 11:44:14 am by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

bill0287

  • Full Member
  • ***
  • Posts: 146
Re: (SOLVED - almost) dbf.filter property question
« Reply #21 on: December 21, 2013, 08:42:56 pm »
This worked and the test worked as well. Thanks for the instructions. I downloaded TortoiseShell SVN to keep laz/fpc up to date now - at least I think that's what it will do for me!

I think this filtering thread is done.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: (SOLVED - almost) dbf.filter property question
« Reply #22 on: December 24, 2013, 01:00:17 pm »
I downloaded TortoiseShell SVN to keep laz/fpc up to date now - at least I think that's what it will do for me!
It isn't needed when using fpcup. Look in c:\development\fpcbootstrap\svn to see the svn client fpcup downloaded for you.

However, TortoiseSVN is very handy and the installer probably adds its svn.exe to the PATH which is useful (see fpcup readme.txt)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018