Page 1 of 1
XBrowse Sample
Posted: Fri Mar 20, 2009 2:30 am
by ryugarai27
Hi FiveWin Experts!
I'm new to Xbrowse and I want to to create 2 xbrowses with reference to different database respectively.. I have used DBFilter but the browses crashes the display after each method call to DelRepos(). I wonder if somebody could send me a sample working program with the situation below:
First browse have records of employee indexed by lastname
Second browse contains transactions of employees from the first xBrowse also indexed by lastname. So that each time the record pointer from first XBrowse moves, the 2nd
Xbrowse should only display the transactions made by that employee on the first xbrowse, and not all the transactions of all employees.
This is my email address :
rblatoza@yahoo.com
Regards,
ryugarai
Re: XBrowse Sample
Posted: Fri Mar 20, 2009 5:17 am
by Richard Chidiak
Ryugarai
There is a bug in the actual version of xbrowse concerning filtered databases
2 ways to fix it :
1. Make the variables contained in the filter expression private not local so they remain visible to xbrowse
2. Change your copy of xbrowse.prg in the delrepos method and comment the filter section this way
Code: Select all
METHOD DelRepos() CLASS TXBrowse
local lRepos := .f.
local cFilter, bFilter
if ::nDataType == DATATYPE_RDD
if ::nLen > 0
if Set( _SET_DELETED ) .and. ( ::cAlias )->( Deleted() )
( ::cAlias )->( dbSkip( 1 ) )
if ( ::cAlias )->( eof() )
( ::cAlias )->( DbGoBottom() )
endif
lRepos := .t.
/*
elseif ! Empty( cFilter := ( ::cAlias )->( dbFilter() ) )
bFilter := &( "{ || " + cFilter + " }" )
if ! ( ::cAlias )->( Eval( bFilter ) )
( ::cAlias )->( dbSkip( 1 ) )
if ( ::cAlias )->( eof() )
( ::cAlias )->( DbGoBottom() )
endif
lRepos := .t.
endif
*/
endif
endif
endif
return lRepos
HTH
Richard
Re: XBrowse Sample
Posted: Fri Mar 20, 2009 9:14 am
by ryugarai27
Hi Richard!
Thanks for a helping hand.. I'll try and inform you of the results.
ryugarai
Re: XBrowse Sample
Posted: Fri Mar 20, 2009 9:38 am
by Silvio
RIchard ...i use dbsetfilter on Xbrowse and I not have problem ....
Re: XBrowse Sample
Posted: Fri Mar 20, 2009 11:47 am
by Richard Chidiak
Silvio
If your filetered expression is to a constant , number or something like this or a public variable, no problem
if you filter to a local variable you get the error as the variable is not visible to xbrowse
Hth
Richard
Re: XBrowse Sample
Posted: Sat Mar 21, 2009 2:41 am
by ryugarai27
Hi Richard,
The filter now works fine, but an error in DelRepos encountered when pressing the Alt key or when resizing columns with mouse.:
Error description: Error BASE/1003 Variable does not exist: CALIAS_PAYDB
Stack Calls
===========
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:DELREPOS(0)
Called from: => EVAL(0)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DELREPOS(0)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:REFRESH(0)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(0)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE(0)
any idea?
Regards,
ryugarai
Re: XBrowse Sample
Posted: Sat Mar 21, 2009 3:00 am
by ryugarai27
Hi Richard,
This is my declaration of DBSetFilter for the second xBrowse:
DBSetFilter( {|| (cAlias_PAYDB)->PONUM == (cAlias_TRANSDB)->PONUM }, '(cAlias_PAYDB)->PONUM == (cAlias_TRANSDB)->PONUM' )
this is the call from the 1st browse, so that everytime the record pointer on the 1st xbrowse moves, the 2nd xbrowse should be refreshed to display only the desired data:
:bChange := {|| (cAlias_PAYDB)->(DBGoTop()), oXbrow:Refresh( TRUE ), oBrowDlg:Update() }
Regards,
ryugarai
Re: XBrowse Sample
Posted: Sat Mar 21, 2009 5:06 am
by Richard Chidiak
Hi Ryugarai,
Please check that you have declared the alias
oXbrow:cAlias := cAlias_PAYDB
Regards,
Richard