FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse: How to display two columns from diferent databases?
Posts: 53
Joined: Wed Aug 06, 2008 05:27 PM
xBrowse: How to display two columns from diferent databases?
Posted: Mon Jul 13, 2009 08:05 AM

Hello,

I need some help with xBrowse and displaying two or more columns from different databases.
Does anyone have simple example or know location in \fwh directory. I saw Mr. James and
Anser posts but I didn't understand how they solved this problem.

regards

Boris

Boris (FWH 20.07, xHarbour 1.2.3, Harbour 3.2.0, BCC74, MySql 5.7)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse: How to display two columns from diferent databases?
Posted: Mon Jul 13, 2009 08:54 AM
If you are asking about fields from two tables related to each other, here is an example. You can run this in \fwh\samples folder. This example uses two tables from that folder.
Code (fw): Select all Collapse
#include "FiveWin.Ch"
#include "ord.ch"
#include "xbrowse.ch"

REQUEST DBFCDX

FIELD STATE, CODE

//------------------------------------------------------------------//

function Main()

   local oWnd, oBrw

    RDDSetDefault( 'DBFCDX' )

   if File( 'states.cdx' )
      FErase( 'states.cdx' )
   endif

   USE STATES NEW EXCLUSIVE
   INDEX ON CODE TAG CODE
   SET ORDER TO TAG CODE

   USE CUSTOMER NEW
   SET RELATION TO STATE INTO STATES
   GO TOP

   DEFINE WINDOW oWnd

   @ 0,0 XBROWSE oBrw OF oWnd             ;
      COLUMNS 'First', 'City', 'State'    ;
      FIELDS STATES->NAME                 ;
      HEADERS ,,,'StateName'              ;
      ALIAS 'CUSTOMER'                    ;
      CELL LINES

   oBrw:CreateFromCode()
   oWnd:oClient   := oBrw

   ACTIVATE WINDOW oWnd

   CLOSE DATA

return ( 0 )

//------------------------------------------------------------------//

I have tested this code and it works. This is how it looks.



First three columns are from customer.dbf and the last column is from states.dbf
Regards



G. N. Rao.

Hyderabad, India
Posts: 53
Joined: Wed Aug 06, 2008 05:27 PM
Re: xBrowse: How to display two columns from diferent databases?
Posted: Mon Jul 13, 2009 10:26 AM

Thank's a lot, your example works great!

Boris

Boris (FWH 20.07, xHarbour 1.2.3, Harbour 3.2.0, BCC74, MySql 5.7)

Continue the discussion