Subject Re: Character ' and applylocate some opinion would be welcome
From Dirk <non@non.com>
Date Wed, 6 Apr 2022 19:52:41 +0200
Newsgroups dbase.getting-started

Op 6/04/2022 om 17:55 schreef Mervyn Bick:
> On 2022/04/06 16:48, Ken Mayer wrote:
>
>>> so i think the last function is doing the same
>>> once by requering and once by applylocate
>>> the point is how to use applylocate without param in the query
>>> and finding words starting with ' ( all others characters are accepted)
>>>
>>> thanks for some additional informatien,
>>
>> The applyLocate() (and filter) options are limited to what SQL they
>> understand (the limits are really based on the BDE itself, not on
>> anything in dBASE).
>>
>> You need to look at the locateOptions (and if you use filter,
>> filterOptions), although it seems that using 3 (Match partial length
>> and ignore case) as you are above, should do the trick. One problem
>> might be if you are looking for words starting with an apostrophe ('),
>> is that apostrophes or single-quotes are delimiters in dBASE and SQL,
>> as are double-quotes. It might help you to build your commands using
>> the square brackets. The other thing is if you do " ' " dBASE is going
>> to be looking for the spaces as well ...
>
> The applyLocate() and filter() methods of a rowset object require SQL
> expressions as the argument.  Unfortunately localSQL as used in dBASE is
> VERY limited.
>
> dBASE will accept single quotes, double quotes or square brackets to
> delimit a string.  localSQL wants single quotes.
>
> oRef.applyLocate([name = 'whatever'])
>   and
> oRef.applyLocate("name = 'whatever'")
>
> are both acceptable.
>
> oRef.applyLocate([name = "whatever"])
>   and
> oRef.applyLocate('name = "whatever"')
>
> are not acceptable.
>
> To use the applyLocate() method to locate a record where the name
> includes an apostrophe it is necessary to "escape" the apostrophe by
> using a \ in front of it/
>
>
> oRef.applyLocate("name = '\'t veer'")
>
> A little example is attached.
>
> Mervyn.
>
>
>
Mervyn, Ken

thanks for the input

i think only dutch speaking people use an apostrophe as company name or
family name

the restrictions giving always more insight

both working

   without params

   case form.keuzedoos_sorteren.value =="firma"
        cVeld = class:: zonder_apostrophe(trim(this.value))
         vraagbak_sort.rowset.locateOptions = 3
         vraagbak_sort.rowset.beginlocate()
        vraagbak_sort.rowset.ApplyLocate([name = '] +cVeld+[ ' ])


  with params

  local cVeld
   this.parent.vraagbak_klant.params["letter"] =
lower(ltrim(rtrim(this.value))+ "%")
   this.parent.vraagbak_klant.requery()
   this.parent.vraagbak_klant.rowset.first()
   this.parent.Veld_zoek.setFocus()


regards

Dirk