oBrowse2DBF ?

This forum is for eXpress++ general support.
Post Reply
Message
Author
DSE
Posts: 4
Joined: Thu Jan 28, 2010 2:59 am

oBrowse2DBF ?

#1 Post by DSE »

Hello Roger,

There is a possibility DCBROWSE object in a DBF copy?

Ayhan

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: oBrowse2DBF ?

#2 Post by rdonnay »

Are you saying that you want to create a new database from the contents of a browse object?

The answer is Yes.

This would be similar to a SQL select statement with the INTO clause.
Before I show you how to do this, I would need a small sample program that displays the browse you want to export to a DBF.
The eXpress train is coming - and it has more cars.

DSE
Posts: 4
Joined: Thu Jan 28, 2010 2:59 am

Re: oBrowse2DBF ?

#3 Post by DSE »

Hello Roger,

Code: Select all

  @ .1,.5 DCBROWSE oBrowse1 PARENT oBrowBox1 ALIAS "rARTIKEL" ;
                SIZE 48.9,19.6  ; 
                PRESENTATION aPres ;
                CURSORMODE XBPBRW_CURSOR_ROW ;  
                SCOPE ;                 
                font  "7.Helv"  ;
                FREEZELEFT { 1, 1 }  ;
                EVAL {|o|o:itemMarked := ;
                         {||xAINV_LoadFields(aApp,DCGETREFRESH_TYPE_EXCLUDE,{GETLIST_BROWSE})} } ;
                HANDLER BrowseHandler REFERENCE aApp ;
                SORTSCOLOR GRA_CLR_WHITE, GRA_CLR_RED ;
                SORTUCOLOR GRA_CLR_WHITE, GRA_CLR_DARKGRAY ;
                SORTUPBITMAP BITMAP_RD_UP_RED  ;               
                SORTDOWNBITMAP BITMAP_RD_DOWN_RED ;
                ID "BROWSE"
        
                DCBROWSECOL FIELD rArtikel->Artnr    WIDTH 4  HEADER msg("ARTNR")             PARENT oBrowse1 ;
                				     SORT {||rArtikel->(OrdSetFocus('ARTNR'))}   LEFTBUTTON _DEFAULT rArtikel->(OrdSetFocus())=='ARTNR'
                DCBROWSECOL FIELD rArtikel->Artkurz  WIDTH 5  HEADER msg("Kurzbezeichnung")   PARENT oBrowse1 ;
                				     SORT {||rArtikel->(OrdSetFocus('ARTKURZ'))} LEFTBUTTON _DEFAULT rArtikel->(OrdSetFocus())=='ARTKURZ'	                                                
                DCBROWSECOL FIELD rArtikel->Artbez   WIDTH 7  HEADER msg("Bezeichnung")   PARENT oBrowse1 ;
                				     SORT {||rArtikel->(OrdSetFocus('ARTBEZ'))}  LEFTBUTTON _DEFAULT rArtikel->(OrdSetFocus())=='ARTBEZ'	                 
                DCBROWSECOL FIELD rArtikel->met      WIDTH 4  HEADER msg("MEZ")   PARENT oBrowse1;
                				     SORT {||rArtikel->(OrdSetFocus('MET'))}     LEFTBUTTON _DEFAULT rArtikel->(OrdSetFocus())=='MET'
                DCBROWSECOL FIELD rArtikel->AGRUPPE  WIDTH 5  HEADER msg("Gruppe")   PARENT oBrowse1  ;
                				     SORT {||rArtikel->(OrdSetFocus('AGRUPPE'))} LEFTBUTTON _DEFAULT rArtikel->(OrdSetFocus())=='AGRUPPE'                                                                                                     
                           
                DCBROWSECOL FIELD  rartikel->BESTAND        WIDTH 5    HEADER msg("Bestand")      PARENT oBrowse1  
                DCBROWSECOL FIELD  rartikel->VKPREIS        WIDTH 5    HEADER msg("VK-Preis") hide {||!pass2("PREIS")} PARENT oBrowse1 

I want to copy this table (oBrowse1) into a new DBF.

Regards
Ayhan

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: oBrowse2DBF ?

#4 Post by rdonnay »

Ok, this is possible. I can create a new function: DC_Browse2Dbf() but you will need to pass some information that cannot be determined automatically from the browse object - unless I create a holder for that info in the DC_XbpBrowse() class.

This is one solution:

DC_Browse2Dbf( oBrowse, cDbfName, aStructure )
Where aStructure is an array that contains the structure of (cDbfName).
This is a function I can write for you without requiring a new eXpress++ release.

Here is another solution:

I can add another clause to the DCBROWSECOL command:
DCBROWSECOL .. STRUCTURE { 'CUST_NAME', 'C', 20, 0 }

This would store the structure info in the oBrowse object to be used later by DC_Browse2Dbf()

It could be possible to create the dbf without structure information by using the column headings as the field names.
The difficulty, however would be in automatically determining the width and decimals of the dbf fields.
The eXpress train is coming - and it has more cars.

DSE
Posts: 4
Joined: Thu Jan 28, 2010 2:59 am

Re: oBrowse2DBF ?

#5 Post by DSE »

The solution DC_Browse2Dbf (oBrowser, cDbfName, aStructure) would be more interesting for me.

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: oBrowse2DBF ?

#6 Post by rdonnay »

Ok. Try the attached file.
Attachments
browse2dbf.zip
DC_Browse2Dbf() test program
(1.4 KiB) Downloaded 873 times
The eXpress train is coming - and it has more cars.

Post Reply