FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour txbrowse dwo database
Posts: 357
Joined: Thu Nov 02, 2006 06:53 PM
txbrowse dwo database
Posted: Sun Nov 09, 2008 07:01 AM

any sample with browse two database db1, db2 with txbrowse

db1 - main database

nr_:=db1->nr

db2->(dbseek(nr,.f.))

best regards

kajot
Posts: 357
Joined: Thu Nov 02, 2006 06:53 PM
txbrowse dwo database
Posted: Sun Nov 09, 2008 08:59 AM

sorry two database

nr_:=db1->nr
db2->(dbseek(nr_,.f.))

best regards

kajot
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
2 Database
Posted: Mon Nov 10, 2008 02:02 PM

Hello Kajot,

In one database I have the customer.
Each customer owns a ID-no, because there can be customers
with the same name.
The 2. database includes the software, belongs to the customer.

To show the software of the customer in Database 2,
i use a RELATION.

Does this sample explain, what you want to do ?

Regards
Uwe :lol:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 357
Joined: Thu Nov 02, 2006 06:53 PM
txbrowse dwo database
Posted: Mon Nov 10, 2008 02:58 PM

I want to browse Invoices (db1) and their items (db2)

best regards

kajot
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
txbrowse dwo database
Posted: Wed Nov 12, 2008 05:36 PM
Please try this sample code. This code uses the states.dbf and customers.dbf in fwh\samples folder.
#include 'fivewin.ch'
#include 'xbrowse.ch'

REQUEST DBFCDX

function Main()

   OpenData()
   BrowseData()

return nil

static function BrowseData

   local oDlg, oBrw1, oBrw2, oFont

   DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-12
   DEFINE DIALOG oDlg SIZE 640,460 PIXEL FONT oFont

   @  10, 10 XBROWSE oBrw1 ;
      COLUMNS 'Code','Name' ;
      SIZE 300,100 PIXEL ;
      OF oDlg ;
      ALIAS 'STATES' ;
      CELL LINES

   @ 120, 10 XBROWSE oBrw2 ;
      COLUMNS 'State', 'City', 'First', 'Salary' ;
      SIZE 300,100 PIXEL ;
      OF oDlg ;
      ALIAS 'CUST' ;
      CELL LINES

   oBrw1:bChange   := { || oBrw2:Refresh() }

   oBrw1:CreateFromCode()
   oBrw2:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED ON INIT oBrw1:SetFocus()
   RELEASE FONT oFont

return nil
//---------------------------------------------------------
static function OpenData

FIELD CODE

   CheckIndex()  // If sure abt indexes comment out this function call

   USE CUSTOMER NEW SHARED ALIAS CUST VIA 'DBFCDX'
   SET ORDER TO TAG STATE
   GO TOP


   USE STATES NEW SHARED VIA 'DBFCDX'
   SET RELATION TO CODE INTO CUST SCOPED
   GO TOP

return nil

static function CheckIndex()

FIELD STATE

   USE CUSTOMER NEW EXCLUSIVE VIA 'DBFCDX'
   If !( OrdNumber( 'STATE' ) > 0 .and. Upper( OrdKey( 'STATE' ) ) == 'STATE' )
      INDEX ON STATE TAG STATE
   endif
   CUSTOMER->( DbCloseArea() )


return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 357
Joined: Thu Nov 02, 2006 06:53 PM
txbrowse dwo database
Posted: Wed Nov 12, 2008 05:47 PM

super, thanks

best regards

kajot

Continue the discussion