Subject Re: SEARCHING VERY LARGE FILE
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Fri, 3 Sep 2021 16:09:19 +0530
Newsgroups dbase.getting-started
Attachment(s) test_search2.wfmtest_search.wfmScreenshot 2021-09-03 154858.jpg

Good Evening Agostinho,

> Dear Akshat I've tried to run the form but it keeps given me an
>   ALERT Error: Class does not exist: TESTINGS2FORM::ENTRYFIELD1_ONKEY1
> I think that the  \"function ENTRYFIELD1_onKey2\" does not execute.

Mighty strange. I am attaching the form again.
Some error may have creeped in.

I have attached a screenshot (of test_search2.wfm) also showing the
existence of the event.
If it still does not work
then close dbase
delete all compiled files
and try
do test_search.wfm with true

This has been checked again and it was working.
with test_search2.wfm the only change I made was the code defining the
query to suit your table.

If both do not work then I will have to try with a custom table and post
the custom table as well
Regards
Akshat



** END HEADER -- do not remove this line
//
// Generated on 02-09-2021
//
parameter bModal
local f
f = new testing2Form()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class testing2Form of FORM
   with (this)
      canClose = class::FORM_CANCLOSE
      onOpen = class::FORM_ONOPEN
      height = 23.1818
      left = 19.8889
      top = 3.68
      width = 146.5714
      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 form_canClose()
      form.timer.enabled = false
      return true

   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()}
      form.timer.enabled = false
    return

    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_onKey2(nChar, nPosition,bShift,bControl)
      if form.verw_oud1.params["ag"] <> "%" + rtrim(ltrim(lower(form.ENTRYFIELD1.value))) + "%"
         form.verw_oud1.params["ag"]  = "%"+rtrim(ltrim(lower(form.ENTRYFIELD1.value)))+"%"
         form.verw_oud1.requery()
         form.verw_oud1.rowset.first()
      endif
      return

endclass



** END HEADER -- do not remove this line
//
// Generated on 02-09-2021
//
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)
      canClose = class::FORM_CANCLOSE
      onOpen = class::FORM_ONOPEN
      height = 23.1818
      left = 19.8889
      top = 3.68
      width = 146.5714
      text = ""
   endwith

   this.DBASESAMPLES1 = new DATABASE(this)
   with (this.DBASESAMPLES1)
      left = 66.0
      top = 3.0
      width = 11.0
      height = 1.0
      databaseName = "DBASESAMPLES"
      active = true
   endwith

   this.VERW_OUD1 = new QUERY(this)
   with (this.VERW_OUD1)
      left = 52.0
      top = 2.0
      width = 8.0
      height = 1.0
      database = form.dbasesamples1
      sql = "select * from CUSTOMERS.DBF where lower(company) 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 form_canClose()
      form.timer.enabled = false
      return true

   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()}
      form.timer.enabled = false
    return

    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_onKey2(nChar, nPosition,bShift,bControl)
      if form.verw_oud1.params["ag"] <> "%" + rtrim(ltrim(lower(form.ENTRYFIELD1.value))) + "%"
         form.verw_oud1.params["ag"]  = "%"+rtrim(ltrim(lower(form.ENTRYFIELD1.value)))+"%"
         form.verw_oud1.requery()
         form.verw_oud1.rowset.first()
      endif
      return

endclass