Here is the suggested change that will cause a pre-existing filter to be maintained even if another filter is configured:
- Code: Select all Expand view
// 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