FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Ayuda con FILTER y MARIADB
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Ayuda con FILTER y MARIADB
Posted: Wed Mar 16, 2022 05:30 AM
Please note that FILTERS are totally different from WHERE clause.

WHERE clause is used to read limited set of records/rows from the table on the server.

FILTER is used to filter records/rows already read into the memory of the client PC (our PC)
Filter clause does not know the field names in the main table. Filters operate on the field name ALIAS used in the query.
Filters behave the same way like ADO.

We request you to kindly read the documentation again to avoid such misunderstandings and loss of time.

In your above example:
Code (fw): Select all Collapse
oQry:SetFilter( "A6 LIKE '%" + ALLTRIM( vGets[ 1 ] ) + "%'" )
oQry:GoTop()
XBROWSER oQry

DO NOT USE REQUERY()

OR, much better to use DBF syntax. We can also use parameterized filters.
Example:
Code (fw): Select all Collapse
oQry:SetFilter( "? $ UPPER(A6)", { Upper( AllTrim( vGets[ 1 ] ) ) } )
oQry:GoTop()
XBROWSER oQry
// later
oQry:Refilter( { "ABC" } )
oQry:GoTop()
XBROWSER oQry
Regards



G. N. Rao.

Hyderabad, India
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Re: Ayuda con FILTER y MARIADB
Posted: Wed Mar 16, 2022 10:52 AM
muchas gracias!

Indicas que primero se use el SETFILTER y luego el REFILTER, como es el método para saber si ya se usó el SETFILTER primero?

a esto me refiero:
if (::SETFILTER() != nil)
...


Gracias
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Ayuda con FILTER y MARIADB
Posted: Wed Mar 16, 2022 12:24 PM

You are the programmer. You know if you previously used oRs:SetFilter() and what parameters you used for this filter, if any.

Anyway
oQry:Filter --> present filter expression
oQry:aFiltParams --> array of parameters used, if any

Regards



G. N. Rao.

Hyderabad, India
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Ayuda con FILTER y MARIADB
Posted: Wed Mar 16, 2022 04:32 PM

Goos:

Tal vez te puede ayudar a re abrir la tabla con la cláusula WHERE

Saludos

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Re: Ayuda con FILTER y MARIADB
Posted: Wed Mar 16, 2022 06:26 PM
Armando wrote:Goos:

Tal vez te puede ayudar a re abrir la tabla con la cláusula WHERE

Saludos


Hola.
Ya Willi me dio una mano y me di cuenta el error que cometĂ­a (REQUERY) despues de aplicar el FILTER no tuve que modificar nada mas de mi codigo, solo comentar el REQUERY()

Gracias a todos!
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/

Continue the discussion