txbrowse dwo database

txbrowse dwo database

Postby kajot » Sun Nov 09, 2008 7: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
User avatar
kajot
 
Posts: 339
Joined: Thu Nov 02, 2006 6:53 pm
Location: Poland

Postby kajot » Sun Nov 09, 2008 8:59 am

sorry two database

nr_:=db1->nr
db2->(dbseek(nr_,.f.))
best regards
kajot
User avatar
kajot
 
Posts: 339
Joined: Thu Nov 02, 2006 6:53 pm
Location: Poland

2 Database

Postby ukoenig » Mon Nov 10, 2008 2: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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby kajot » Mon Nov 10, 2008 2:58 pm

I want to browse Invoices (db1) and their items (db2)
best regards
kajot
User avatar
kajot
 
Posts: 339
Joined: Thu Nov 02, 2006 6:53 pm
Location: Poland

Postby nageswaragunupudi » Wed Nov 12, 2008 5:36 pm

Please try this sample code. This code uses the states.dbf and customers.dbf in fwh\samples folder.
Code: Select all  Expand view
#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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby kajot » Wed Nov 12, 2008 5:47 pm

super, thanks
best regards
kajot
User avatar
kajot
 
Posts: 339
Joined: Thu Nov 02, 2006 6:53 pm
Location: Poland


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 62 guests