XBrowse Sample

Post Reply
User avatar
ryugarai27
Posts: 65
Joined: Fri Feb 13, 2009 12:03 pm
Location: Manila, Philippines
Contact:

XBrowse Sample

Post 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
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: XBrowse Sample

Post 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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
ryugarai27
Posts: 65
Joined: Fri Feb 13, 2009 12:03 pm
Location: Manila, Philippines
Contact:

Re: XBrowse Sample

Post by ryugarai27 »

Hi Richard!

Thanks for a helping hand.. I'll try and inform you of the results.

ryugarai
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: XBrowse Sample

Post by Silvio »

RIchard ...i use dbsetfilter on Xbrowse and I not have problem ....
Best Regards, Saludos

Falconi Silvio
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: XBrowse Sample

Post 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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
ryugarai27
Posts: 65
Joined: Fri Feb 13, 2009 12:03 pm
Location: Manila, Philippines
Contact:

Re: XBrowse Sample

Post 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
User avatar
ryugarai27
Posts: 65
Joined: Fri Feb 13, 2009 12:03 pm
Location: Manila, Philippines
Contact:

Re: XBrowse Sample

Post 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
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: XBrowse Sample

Post by Richard Chidiak »

Hi Ryugarai,

Please check that you have declared the alias

oXbrow:cAlias := cAlias_PAYDB

Regards,

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Post Reply