Improvement to DBFs management ...

Re: Improvement to DBFs management ...

Postby James Bott » Tue Oct 13, 2009 11:50 am

>oCustomer:fieldPos( cFieldname )

Opps, I meant:

oCustomer:aBuffer[oCustomer:fieldPos( cFieldname )]

The data is stored in aBuffer so you need the location in aBuffer for the fieldname.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Improvement to DBFs management ...

Postby PeterHarmes » Tue Oct 13, 2009 12:42 pm

Thanks for the info James

Regards,

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Improvement to DBFs management ...

Postby nageswaragunupudi » Tue Oct 13, 2009 2:45 pm

Rimantas wrote:
nageswaragunupudi wrote:TDataBase class comes free with FWH



In earliest versions of FWH this was not fully completed . Can you confirm a good results with that class ?

Regards !

I am using TDataBase class without any problems. I know some other programmers who are also using the TDataBase class comfortably.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Improvement to DBFs management ...

Postby nageswaragunupudi » Tue Oct 13, 2009 2:58 pm

PeterHarmes wrote:James,

Interested in using a database class, but was wondering how i use the class in the following situation:

I give my clients the ability to modify what appears in a browse and in what order the columns appear in, so i have a database that holds the browse info, like this:

Browse Code, Column Number, Field, Size, Header

for example:

CUSTOMER,1,CUSTOMER->ACNT_NBR,100, "Account"
CUSTOMER,2,CUSTOMER->ACNT_NAME,300,"Name"
etc..

The way i currently do this, is to do a strtran on the info read from the database, so if the CUSTOMER alias was CUST01 I would transform the "Field" field to "CUST01->ACNT_NBR" & "CUST01->ACNT_NAME" etc..

How can i do this with either tData or tDataBase class?

Best Regards,

Pete

I may suggest a very easy way to create such an XBrowse.

Have the column names, headers and column sizes in 3 arrays ....
example, column names aCols := { 'ACNT_NMBR', 'ACNT_NAME', ..... }
column headers aHead := { "Account", "Name", ..... }
column sizes aSizes := { 100, 200, ..... }
It is easy for you to construct these arrays from your browse info database table.

Now to create the browse :
@ <row>,<col> XBROWSE oBrw SIZE <width>,<height> PIXEL OF oWnd ;
COLUMNS aCols HEADERS aHead COLSIZES aSizes OBJECT oCust CELL LINES

I assume oCust to be the Database object. ( TData or TDataBase )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Improvement to DBFs management ...

Postby PeterHarmes » Tue Oct 13, 2009 3:11 pm

Just had another thought, what about if you had a related database and you wanted a browse that referenced both objects/databases?

Regards,

Pete
PeterHarmes
 
Posts: 363
Joined: Wed Feb 15, 2006 2:06 pm
Location: Oxford, England

Re: Improvement to DBFs management ...

Postby nageswaragunupudi » Tue Oct 13, 2009 3:22 pm

PeterHarmes wrote:Just had another thought, what about if you had a related database and you wanted a browse that referenced both objects/databases?

Regards,

Pete

In xbrowse syntax is identical for dbf, database objects or ado recordsets. That being said, I like to provide the answer to the above question using two related to dbf tables.

@ r,c XBROWSE oBrw ................of oWnd ;
COLUMNS 'col1', 'col2', ... ; // main dbf
FIELDS dbf2->colx, dbf2->coly ; // related dbf
HEADERS 'HEAD1', 'HEAD2', 'HEAD3', 'HEAD4' ;
...................

Now we may like to have the columns displayed in the browse in a different order .. for examples in the order of HEAD3, HEAD1, HEAD4, HEAD3. We can reorder the columns with this method:

oBrw:ReArrangeCols( 'HEAD3', 'HEAD1', 'HEAD4', 'HEAD3' )

Now browse shows the columns in this new order.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Improvement to DBFs management ...

Postby James Bott » Tue Oct 13, 2009 4:31 pm

Pete,

>Just had another thought, what about if you had a related database >and you wanted a browse that referenced both objects/databases?

There are several ways to do this with database objects.

You can use the skipper to keep both databases in sync:

oLbx:bSkip:= {| nRecs | oInvoice:skipper( nRecs), oCustomer:seek( oInvoice:invno) }

Then you just define the fields:

@ 0,0 LISTBOX oLbx FIELDS oInvoice:invno, oCust:company...

Also you can build complex objects--objects that contain other objects. Then you have have a invoice table (database) object that contains the customer table. The invoice object keeps them in sync. Then you can just do:

@ 0,0 LISTBOX oLbx FIELDS oInvoice:invno, oInvoice:oCustomer:company...

Objects can be very powerful and flexible.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 39 guests