FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBrowse Sample
Posts: 65
Joined: Fri Feb 13, 2009 12:03 PM
XBrowse Sample
Posted: Fri Mar 20, 2009 02:30 AM

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 : <!-- e --><a href="mailto:rblatoza@yahoo.com">rblatoza@yahoo.com</a><!-- e -->

Regards,
ryugarai

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: XBrowse Sample
Posted: Fri Mar 20, 2009 05:17 AM
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 (fw): Select all Collapse
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
Posts: 65
Joined: Fri Feb 13, 2009 12:03 PM
Re: XBrowse Sample
Posted: Fri Mar 20, 2009 09:14 AM

Hi Richard!

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

ryugarai

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: XBrowse Sample
Posted: Fri Mar 20, 2009 09:38 AM

RIchard ...i use dbsetfilter on Xbrowse and I not have problem ....

Best Regards, Saludos



Falconi Silvio
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: XBrowse Sample
Posted: Fri Mar 20, 2009 11:47 AM

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
Posts: 65
Joined: Fri Feb 13, 2009 12:03 PM
Re: XBrowse Sample
Posted: Sat Mar 21, 2009 02:41 AM

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

Posts: 65
Joined: Fri Feb 13, 2009 12:03 PM
Re: XBrowse Sample
Posted: Sat Mar 21, 2009 03:00 AM

Hi Richard,

  This is my declaration of DBSetFilter for the second xBrowse:

     DBSetFilter( {|| (cAlias_PAYDB)-&gt;PONUM == (cAlias_TRANSDB)-&gt;PONUM }, '(cAlias_PAYDB)-&gt;PONUM == (cAlias_TRANSDB)-&gt;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)-&gt;(DBGoTop()), oXbrow:Refresh( TRUE ), oBrowDlg:Update() }

Regards,

ryugarai

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: XBrowse Sample
Posted: Sat Mar 21, 2009 05:06 AM

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

Continue the discussion