| Subject |
Re: Like query |
| From |
Akshat Kapoor <akshat.kapoor@kapoorsons.in> |
| Date |
Wed, 25 May 2022 08:02:45 +0530 |
| Newsgroups |
dbase.getting-started |
Good morning Tom,
> dBase 13.1
> Windows 10 Pro
> Version 21H2
Still with 12.31 and windows home. So just tested what I could
>
> Having stolen one of Mervyn's sample forms, I have changed databases,
> tables and fields for a trial. The field name contains a space but
> otherwise is a character field. Using single quotes, double quotes and
> brackets around the field name still fails to 'find' any entries I type.
> Ultimately, I would like to use 'like' with the date field in the table
> too.
>
> height = 1.0
> database = form.DBASETUTORIAL1
> sql = [select * from INVOICE.DBF where lower('Card Name') like :search]
> params["search"] = '%'
> active = true
On my computer
select * from inve where lower(descrip) like '%air%' is working fine.
I would suggest running the following in our command window and checking
the sql
First set the dtabase in navigator to desired database.
select * from INVOICE.DBF where lower('Card Name') like '%ABC%'
browse
Change ABC to any desired value
You should see the desired results. If not then the space in field name
is causing issues.
Try the same code with different fieldname without spaces.
> function ENTRYFIELD1_onKey(nChar, nPosition,bShift,bControl)
> ***if nChar = 13 //uncomment to prevent requery until Enter is
> pressed
> if form.radiobutton1.value = true
> form.INVOICE1.params['search'] =
> '%'+trim(lower(form.entryfield1.value))+'%'
> else
> form.INVOICE1.params['search'] =
> trim(lower(form.entryfield1.value))+'%'
> endif
> if empty(form.entryfield1.value)
> form.INVOICE1.params['search'] = '%'
> endif
> form.INVOICE1.requery()
> ***endif
> return
This code will be okay for testing but on deployment may cause a bit
slowdown in search as it will requery() after each key stroke. I use a
timer to wait for 0.5 to 1 seconds before performing a requery.
But this is next step. First get your sql working.
Regards
Akshat
|
|