By using the class xbrowse noticed that preexitentes filters were not being maintained during the call to xbrowse, I made a small change in class to solve the problem if you can add the xbrowse.
I do not know if the code is well written, can adapt to better performace.
Thank U.
xbrowse.prg
Code: Select all
METHOD RddIncrFilter( cExpr, uSeek ) CLASS TXBrowse
local oBrw := Self
local lFound := .f.
local cKey
local cFilter
if ::bFilterExp == nil
DEFAULT ::cFilterFld := OrdKey()
cKey := ::cFilterFld
if ::lSQLRDD
if Empty( cExpr )
cFilter := ""
else
cExpr := If( ::lSeekWild, "'%", "'" ) + Upper( Trim( cExpr ) ) + "%'"
cFilter := cKey + " LIKE " + cExpr
endif
else
if ValType( &cKey ) == 'C'
if ! "UPPER" $ Upper( cKey )
cKey := "UPPER( " + cKey + " )"
endif
else
cKey := "CVALTOCHAR(" + cKey + ")"
endif
if Empty( cExpr )
cFilter := if(!empty(dbfilter()) .and. '.and. WildMatch'$dbfilter(), alltrim(substr(dbfilter(), 1, ;
at('.and. WildMatch', dbfilter()) - 1 )), if(empty(dbfilter()), '!deleted()', dbfilter())) // '!deleted()'
oBrw:gotop()
elseif ::lSeekWild
#ifdef __XHARBOUR__
cFilter := if(!empty(dbfilter()) .and. '.and. WildMatch'$dbfilter(), alltrim(substr(dbfilter(), 1, ;
at('.and. WildMatch', dbfilter()) - 1 )), dbfilter()) // '!deleted()'
cFilter := cFilter + if(!empty(dbfilter()), ' .and. ', '') + 'WildMatch("*' + Upper( Trim( cExpr ) ) + '*",' + cKey + ')'
#else
cFilter := dbfilter() + if(!empty(dbfilter()), ' .and. ', '') + 'HB_WildMatch("*' + Upper( Trim( cExpr ) ) + '*",' + cKey + ')'
#endif
else
cFilter := if(!empty(dbfilter()) .and. '.and. WildMatch'$dbfilter(), alltrim(substr(dbfilter(), 1, ;
at('.and. WildMatch', dbfilter()) - 1 )), dbfilter()) // '!deleted()'
cFilter := cFilter + if(!empty(dbfilter()), ' .and. ', '') + cKey + '="' + Upper( Trim( cExpr ) ) + '"'
endif
endif
/*
if Empty( cExpr )
cFilter := '!deleted()'
elseif ::lSeekWild
#ifdef __XHARBOUR__
cFilter := 'WildMatch("*' + Upper( Trim( cExpr ) ) + '*",' + cKey + ')'
#else
cFilter := 'HB_WildMatch("*' + Upper( Trim( cExpr ) ) + '*",' + cKey + ')'
#endif
else
cFilter := cKey + '="' + Upper( Trim( cExpr ) ) + '"'
endif
endif
*/
else
cFilter := Eval( ::bFilterExp, cExpr )
endif
if ! ::lSQLRDD .and. &cFilter
uSeek := ::BookMark
endif
SET FILTER TO &cFilter
GO TOP
lFound := ::KeyCount() > 0
return lFound