class xbrowse: suggestion for improvement
Posted: Sat Jun 01, 2019 1:06 pm
I have for some time been aware that when using the RddIncrFilter method, it made a preexisting filter be lost when changing the search filter, I made a change in the class I would like to share to check if it is the best solution and suggest that they implement it future versions of fwh.
Here is the suggested change that will cause a pre-existing filter to be maintained even if another filter is configured:
Any improvements your colleagues might suggest or a better solution, feel free to suggest.
Thanks
Here is the suggested change that will cause a pre-existing filter to be maintained even if another filter is configured:
Code: Select all
// new code
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
// end new code
/*
// old code
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
*/
// end old code
Any improvements your colleagues might suggest or a better solution, feel free to suggest.
Thanks