Subject Re: applylocate not working
From Charlie <tm@tc.com>
Date Fri, 07 Jun 2024 16:32:32 -0400
Newsgroups dbase.getting-started

Hi Ken...  Thanks.  I tried that but it still is not found.  It is almost apply locate has stopped working, although it still works in other programs i've written..

I have tried using a xdml function using locate which actually finds the row but i am having problems returning something to the form because the field for grade is selected by the user and there are 11 different fields for grade in the table.  I am not sure how to handle that.  I have tried macros, etc,   And although it seems to find the row, it doesn't seem to remember the row when I try to return it to the form.  It sees row 1 only.

This is a mess.  Possibly there is something screwy with my computer.  I hope not.

Ken Mayer Wrote:

> On 6/7/2024 7:43 AM, Charlie wrote:
> > I thought this would be easy since I have done this before but the apply locate is never found.  tgrade is what i am trying to find.  actually it represents a field in the table.  so that isn't the problem (yet) because this never finds tid and cat which are also strings.
> >
> > i have tried this looking for bith variables and only one which certainly should have been found, but for some reason the applylocate doesn't work.
> >
> > Can anyone help?
> >
>
> Have you considered the locateOptions? Are you perhaps looking for a
> string that is not matching based on case? What about length?
>
> Adding the statement:
>
> co.locateOptions := 3 // ignore case and length
>
> The default is to match case, and match the length of the values you are
> looking for. There are other options, see help for "locateOptions". I
> have shown the best place to add this below:
>
> >
> >
> >   function COMBOBOX4_onChange()
> >            co = form.coins1.rowset
> co.locateOptions := 3 // ignore case and length
> >            tgrade = trim(form.combobox4.value)
> >                 tid = trim(form.entryfield5.value)
> >                 tcat= trim(form.combobox2.value)
> >                 //co.applylocate("year= '" + tid + "'")// and category= '" + tcat + "'")
> >                 co.applylocate( "year= '" + 'tid' + "' and category= '" + tcat + "'")
> >                 form.entryfield1.value = val(co.fields["&tgrade."].value)
> >                 //if found()
> >                    msgbox( ""+found() )
>
> --
> *Ken Mayer*
> Ken's dBASE Page: http://www.goldenstag.net/dbase
> The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
> dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
> dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
> dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
> dBASE DOS to Windows Tutorial:
> http://www.goldenstag.net/dbase/DtoWTutorial/00_Menu.htm
>