Subject Re: SEARCHING VERY LARGE FILE
From AGOSTINHO <AGOSTINHOTEIXEIRA@YAHOO.COM>
Date Wed, 01 Sep 2021 23:50:53 -0400
Newsgroups dbase.getting-started

Dear Aksaht,
I've added it to my form but it don't works and I'm getting
the following error Class does not exist; TESTINGFORM::ENTRYFIELD_ONKEY1
Please revise the form and help me to make it work.
Thanks

parameter bModal
local f
f = new testingForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class testingForm of FORM
   with (this)
      onOpen = class::FORM_ONOPEN
      height = 23.2
      left = 19.8889
      top = 3.68
      width = 146.5556
      text = ""
   endwith

   this.VERW_OUD1 = new QUERY(this)
   with (this.VERW_OUD1)
      left = 31.0
      top = 13.0
      sql = 'select * from "C:\Users\HOME_PC\Desktop\dbasetutorial\verw_oud.dbf" where lower(descript) like lower(:ag)'
      params["ag"] = "%"
      active = true
   endwith

   this.ENTRYFIELD1 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD1)
      onKey = class::ENTRYFIELD1_ONKEY1
      height = 1.92
      left = 11.0
      top = 0.96
      width = 19.0
      value = ""
   endwith

   this.GRID1 = new GRID(this)
   with (this.GRID1)
      dataLink = form.verw_oud1.rowset
      bgColor = "WindowText"
      height = 19.08
      left = 1.0
      top = 3.36
      width = 136.0
   endwith


*function ENTRYFIELD1_onKey1(nChar, nPosition,bShift,bControl)
     *if nChar = 13 //Enter key
        *form.verw_oud1.params['ag'] = '%'+this.value+'%'
        *form.verw_oud1.requery()
     *endif
     *return

        
   *function ENTRYFIELD1_onKey1(nChar, nPosition,bShift,bControl)
       *form.verw_oud1.params['ag'] = '%'+this.value+'%'
       *form.verw_oud1.requery()
      *return

   function form_onOpen()
      _app.select2 = form
       form.twait = false
       form.timer = new timer()
       form.timer.interval = 0.75
       form.timer.ontimer = {;_app.select2.twait = false;_app.select2.timer.enabled = false; _app.select2.ENTRYFIELD1_onkey2()}
       //Watch for word wrap in above line and the following lines also.
       form.timer.enabled = false

    function ENTRYFIELD1_onKey1(nChar, nPosition,bShift,bControl)
                if form.twait
//                        do nothing
//                        We are waiting for additional key strokes
                else
                        form.twait = true
                        form.timer.enabled = true
                endif
       return


    function ENTRYFIELD1_onKey1(nChar, nPosition,bShift,bControl)
        if form.verw_oud1 <> alltrim(upper(form.ENTRYFIELD1.value))
           form.verw_oud1 = alltrim(upper(form.ENTRYFIELD1.value))
           form.invedatamodule1.inve.params["ag"].value = "%"+this.value+"%"
           form.invedatamodule1.inve.requery()
           form.rowset.first()
        endif
       return
      return

endclass



Akshat Kapoor Wrote:

> Good Evening Agostinho,
>
> > This method works as a charm in medium/small files, it is very simple with only a few lines of programming, every ones knows  that the incremental search is the actual way to go, similar to google search.
> > Indexes works fine but it will reach only the information at the beginning of each records, this way of search is not efficient.
> > I'll keep  on researching until I get a perfect method to get a good incremental search for my large databases.
> > Once again thank you very much and have a wonderful day.
>
> Have you tried using a timer.
> I prefer waiting for 1 second before requery()
>
> The code that I use
>
> in Form_onOpen
>
>        _app.select2 = form
>        form.twait = false
>        form.timer = new timer()
>        form.timer.interval = 0.75
>        form.timer.ontimer = {;_app.select2.twait = false ;
> _app.select2.timer.enabled = false; _app.select2.searchcode_onkey2()}
> //Watch for word wrap in above line and the following lines also.
>        form.timer.enabled = false
>
>
>     function SEARCHCODE_onKey(nChar, nPosition,bShift,bControl)
>                 if form.twait
> //                        do nothing
> //                        We are waiting for additional key strokes
>                 else
>                         form.twait = true
>                         form.timer.enabled = true
>                 endif
>        return
>
>
>     function SEARCHCODE_onKey2(nChar, nPosition,bShift,bControl)
>         if form.sc <> alltrim(upper(form.searchcode.value))
>            form.sc = alltrim(upper(form.searchcode.value))
>             form.invedatamodule1.inve.params["SC"].value = "%"+form.sc+"%"
>             form.invedatamodule1.inve.requery()
>            form.rowset.first()
>         endif
>        return
>
>
> I have stripped the code of lots of lines that were customised for my
> special usage.
>
> But hopefully I have been able to pass on the concept.
>
> Regards
> Akshat