Hi there,

when calling the customers list function in my foxpro application I get
all records from my MySQL database (customer's table) via ODBC. Then I
call a form which has a grid controlling id an name fields of the
customer table. A text field is used to filter records by name. If you
enter something in that field, I am doing a

SET FILTER to OCCURS(UPPER(thisform.searchword), UPPER(customer.name))
> 0
GO top in customer
thisform.grid_wa.refresh()

Everything works fine until the grid gets the focus after entering the
search information. After getting the focus only one (instead of three
found) record is shown, it is alwas the first one in the list. If I do
a "thisform.grid_wa.setfocus()" instead of the refresh, nothing at all
is shown.

Doing a
SET FILTER to OCCURS("Miller", UPPER(customer.name)) > 0
instead of using the thisform.serachword variable works without problem
so I guess there is something wrong with the SET FILTER and using
variables?

I am using VFP8 on W2k english.

Thanks in advance
Andi

RE: filtered records not shown correctly in a grid aftger grid has got by MichelRoy

MichelRoy
Mon Dec 05 12:40:02 CST 2005

it is not a good idea to use keyword "thisform" in a filter cause when the
form loses focus... thisform is meaningless

lcFilter = TEXTMERGE([OCCURS(UPPER("<<thisform.searchword>>"),
UPPER(customer.name))])
set filter to &lcFilter.

"andipfaff" wrote:

> Hi there,
>
> when calling the customers list function in my foxpro application I get
> all records from my MySQL database (customer's table) via ODBC. Then I
> call a form which has a grid controlling id an name fields of the
> customer table. A text field is used to filter records by name. If you
> enter something in that field, I am doing a
>
> SET FILTER to OCCURS(UPPER(thisform.searchword), UPPER(customer.name))
> > 0
> GO top in customer
> thisform.grid_wa.refresh()
>
> Everything works fine until the grid gets the focus after entering the
> search information. After getting the focus only one (instead of three
> found) record is shown, it is alwas the first one in the list. If I do
> a "thisform.grid_wa.setfocus()" instead of the refresh, nothing at all
> is shown.
>
> Doing a
> SET FILTER to OCCURS("Miller", UPPER(customer.name)) > 0
> instead of using the thisform.serachword variable works without problem
> so I guess there is something wrong with the SET FILTER and using
> variables?
>
> I am using VFP8 on W2k english.
>
> Thanks in advance
> Andi
>
>

Re: filtered records not shown correctly in a grid aftger grid has got focus by Dan

Dan
Mon Dec 05 16:06:39 CST 2005

I'd recommend against SET FILTER in general, and in this particular case a
parameterized remote view will definitely be better and has most of what
you're looking for built-in.

Dan

andipfaff wrote:
> Hi there,
>
> when calling the customers list function in my foxpro application I
> get all records from my MySQL database (customer's table) via ODBC.
> Then I call a form which has a grid controlling id an name fields of
> the customer table. A text field is used to filter records by name.
> If you enter something in that field, I am doing a
>
> SET FILTER to OCCURS(UPPER(thisform.searchword), UPPER(customer.name))
>> 0
> GO top in customer
> thisform.grid_wa.refresh()
>
> Everything works fine until the grid gets the focus after entering the
> search information. After getting the focus only one (instead of three
> found) record is shown, it is alwas the first one in the list. If I do
> a "thisform.grid_wa.setfocus()" instead of the refresh, nothing at all
> is shown.
>
> Doing a
> SET FILTER to OCCURS("Miller", UPPER(customer.name)) > 0
> instead of using the thisform.serachword variable works without
> problem so I guess there is something wrong with the SET FILTER and
> using variables?
>
> I am using VFP8 on W2k english.
>
> Thanks in advance
> Andi



Re: filtered records not shown correctly in a grid aftger grid has got by andipfaff

andipfaff
Tue Dec 06 02:58:38 CST 2005

The form does not loose the focus. Anyway I took up that idea and
replaced the local variable thisform.searchword with a global and that
worked then.

Unroftunately I am absolutely NOT familiar with "parameterized remote
views", and I don't have the time to learn that now. So this quick but
dirty solution is OK for me as I do not use something similar again in
my application.

Thanks again