Customer .dbf

Customer .dbf

Postby TimStone » Tue May 12, 2020 8:23 pm

I'm trying to run a sample, and it wants to use CUSTOMER.DBF. However I keep getting the error when trying to USE it that there is an unknown field type. I believe the first field is ID and the type is +. I finally saw this with an ASCII text editor.

The file cannot be opened in any of my file editors, ie. ADS Data Architect or DBU.

I found a Customer.ch in the samples directory and even linked it into the program.

The program I'm trying to test is EREP01.prg which I've linked into my main application. ( This is a pretty easy way I use for testing samples ).

Any ideas on how to get around this. The sample code is unmodified ( except to rename the function other than Main() ).

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Customer .dbf

Postby cnavarro » Tue May 12, 2020 9:33 pm

Tim, try with this version of FiveDbu
https://bitbucket.org/fivetech/fivewin- ... IVEDBU.EXE
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Customer .dbf

Postby TimStone » Tue May 12, 2020 10:56 pm

It opens as a Type +, but trying to use that file in a program built with FWH 20.04, Harbour, and MSVC, when executing, it does not see that field type. Of course, I'm using the RDDADS ...

So I tested it with DBFCDX and it opens the browse ... but the program I wanted to test is still failing ... will look further.

So that + field type is not going to work with ADS ...
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Customer .dbf

Postby cnavarro » Wed May 13, 2020 12:37 am

TimStone wrote:It opens as a Type +, but trying to use that file in a program built with FWH 20.04, Harbour, and MSVC, when executing, it does not see that field type. Of course, I'm using the RDDADS ...

So I tested it with DBFCDX and it opens the browse ... but the program I wanted to test is still failing ... will look further.

So that + field type is not going to work with ADS ...


I think the field type "+" is not supported with ADS
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Customer .dbf

Postby nageswaragunupudi » Wed May 13, 2020 8:24 am

AutoIncrement field in DBFCDX/DBFNTX is represented as "+".
AutoInc fields of DBFCDX/DBFNTX are not compatible with autoincrement field of ADS.

Older DBUs and other older DBF maintenance programs may not support recently implemented fieldtypes : +. =. @, V.
Such software need to be updated by their authors.
Regards

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

Re: Customer .dbf

Postby Silvio.Falconi » Wed May 13, 2020 2:06 pm

TimStone wrote:It opens as a Type +, but trying to use that file in a program built with FWH 20.04, Harbour, and MSVC, when executing, it does not see that field type. Of course, I'm using the RDDADS ...

So I tested it with DBFCDX and it opens the browse ... but the program I wanted to test is still failing ... will look further.

So that + field type is not going to work with ADS ...


on samples there is a file to build customers.dbf without + field
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Customer .dbf

Postby MOISES » Wed May 13, 2020 5:13 pm

Hello,

This is the fix for incremental fields:

Code: Select all  Expand view  RUN
function New( cAlias, cFileName )

   local oDlg, oGet, oBrw, oBtn, cTitle, cNewAlias, oBrwNew, lCopy := .F.
   local cFieldName := Space( 10 ), cType := "Character", nLen := 10, nDec := 0
   local aFields := { Array( 4 ) }, cDbfName := Space( 8 ), aTemp
   local oLen, oDec, aType := { "AutoIncr", "Character", "Number", "Date", "Logical", "Memo", "ModTime" }
   local bChange := {|| If( cType == "AutoIncr",  ( nLen := 4,  nDec := 0, oDec:Disable()  ),),;
                        If( cType == "Character", ( nLen := 10, nDec := 0, oDec:Disable() ),),;
                        If( cType == "Number",    ( nLen := 10, nDec := 0, oDec:Enable()  ),),;
                        If( cType == "Date",      ( nLen := 8,  nDec := 0, oDec:Disable() ),),;
                        If( cType == "Logical",   ( nLen := 1,  nDec := 0, oDec:Disable() ),),;
                        If( cType == "Memo",      ( nLen := 10, nDec := 0, oDec:Disable() ),),;
                        If( cType == "ModTime",   ( nLen := 8, nDec := 0, oDec:Disable() ),),;
                        oDlg:Update() }
   local bEdit := {|| IF ( !Empty (aFields[1,1]) ,;
                      (oBtn:Enable (),;
                       cFieldName := aFields[oBrw:nArrayAt,1] ,;
                       cType := aFields[oBrw:nArrayAt,2] ,;
                       cType := aType[ aScan(aType, {|x| Left(x,1) = cType} )],;
                       Eval (bChange) ,;
                       nLen := aFields[oBrw:nArrayAt,3] ,;
                       nDec := aFields[oBrw:nArrayAt,4] ,;
                       oGet:SetPos( 0 ),;
                       oGet:SetFocus(),;
                       oDlg:Update() ) ,) ;
                     }
   local bSave := { || oBtn:Disable (),;
                      aFields[ oBrw:nArrayAt, 1 ] := cFieldname,;
                      aFields[ oBrw:nArrayAt, 2 ] := if( Left( cType, 1 ) = "A", "+", Left( cType, 1 ) ), ;
                      aFields[ oBrw:nArrayAt, 2 ] := if( Left( cType, 3 ) = "Mod", "=", Left( cType, 1 ) ), ;
                      aFields[ oBrw:nArrayAt, 3 ] := nLen,;
                      aFields[ oBrw:nArrayAt, 4 ] := nDec,;
                      oBrw:SetArray( aFields ),;
                      cFieldName := Space( 10 ),;
                      Eval( bChange ) ,;
                      oDlg:Update() ,;
                      oGet:SetPos( 0 ),;
                      oGet:SetFocus(),;
                      oBrw:GoBottom();
                      }

   if ! Empty( cAlias )
      aFields = ( cAlias )->( DbStruct() )
      cTitle = FWString( "Modify DBF structure" )
   else
      cTitle = FWString( "DBF builder" )
   endif

   DEFINE DIALOG oDlg TITLE cTitle SIZE 415, 500

   @ 0.5,  2 SAY FWString( "Field Name" ) OF oDlg SIZE 40, 8
   @ 0.5, 10 SAY FWString( "Type" ) OF oDlg SIZE 40, 8
   @ 0.5, 17 SAY FWString( "Len" )  OF oDlg SIZE 40, 8
   @ 0.5, 22 SAY FWString( "Dec" )  OF oDlg SIZE 20, 8

   @ 1.4, 1 GET oGet VAR cFieldName PICTURE "!!!!!!!!!!" OF oDlg SIZE 41, 11 UPDATE

   @ 1.3, 6.5 COMBOBOX cType ITEMS aType ;
      OF oDlg ON CHANGE Eval (bChange) UPDATE

   @ 1.4, 11.9 GET oLen VAR nLen PICTURE "999" OF oDlg SIZE 25, 11 UPDATE

   @ 1.4, 15.4 GET oDec VAR nDec PICTURE "999" OF oDlg SIZE 25, 11 UPDATE

   @ 0.9, 26 BUTTON FWString( "&Add" ) OF oDlg SIZE 45, 13 ;
      ACTION AddField( @aFields, @cFieldName, @cType, @nLen, @nDec, oGet, oBrw )

   @ 2.4, 26 BUTTON oBtn PROMPT FWString( "&Edit" ) OF oDlg SIZE 45, 13 ;
     ACTION Eval (bSave)

   @ 3.4, 26 BUTTON FWString( "&Delete" ) OF oDlg SIZE 45, 13 ;
     ACTION DelField( @aFields, @cFieldName, oGet, oBrw )

   @ 4.4, 26 BUTTON FWString( "Move &Up" ) OF oDlg SIZE 45, 13 ;
      ACTION If( oBrw:nArrayAt > 1,;
                 ( aTemp := aFields[ oBrw:nArrayAt ],;
                   aFields[ oBrw:nArrayAt ] := aFields[ oBrw:nArrayAt - 1 ],;
                   aFields[ oBrw:nArrayAt - 1 ] := aTemp,;
                   oBrw:GoUp() ),)

   @ 5.4, 26 BUTTON FWString( "Move D&own" ) OF oDlg SIZE 45, 13 ;
      ACTION If( oBrw:nArrayAt < Len( aFields ),;
                 ( aTemp := aFields[ oBrw:nArrayAt ],;
                   aFields[ oBrw:nArrayAt ] := aFields[ oBrw:nArrayAt + 1 ],;
                   aFields[ oBrw:nArrayAt + 1 ] := aTemp,;
                   oBrw:GoDown() ),)

   @ 11.8, 26 BUTTON FWString( "&Cancel" ) OF oDlg SIZE 45, 13 ;
      ACTION oDlg:End()

   @ 2.0, 1.8 SAY "Struct" OF oDlg SIZE 40, 8

   @ 3.0, 1 XBROWSE oBrw ARRAY aFields AUTOCOLS NOBORDER STYLE FLAT ;
      HEADERS FWString( "Name" ), FWString( "Type" ), FWString( "Len" ),;
              FWString( "Dec" ) ;
      COLSIZES 90, 55, 40, 40 ;
      SIZE 138, 183 OF oDlg ;
      ON DBLCLICK Eval (bEdit)

   StyleBrowse( oBrw )
   if lPijama
      oBrw:bClrStd := { || If( oBrw:KeyNo() % 2 == 0, ;
                            { CLR_BLACK, RGB( 198, 255, 198 ) }, ;
                            { CLR_BLACK, RGB( 232, 255, 232 ) } ) }
      oBrw:bClrSel := { || { CLR_WHITE, RGB( 0x33, 0x66, 0xCC ) } }
   else
      oBrw:bClrStd := { || { nClrTxtBrw, nClrBackBrw }  }
      oBrw:bClrSel := { || { nClrBackBrw, RGB( 0x33, 0x66, 0xCC ) } }
   endif
   oBrw:CreateFromCode()

   @ 15.3, 1.4 SAY FWString( "DBF Name:" ) OF oDlg SIZE 40, 8

   if ! Empty( cAlias )
      cDbfName = cGetNewAlias( cAlias )
   endif

   @ 17.7, 6 GET cDbfName PICTURE "!!!!!!!!!!!!" OF oDlg SIZE 100, 11

   @ 12.8, 26 BUTTON If( Empty( cAlias ), FWString( "&Create" ), FWString( "&Save" ) ) ;
      OF oDlg SIZE 45, 13 ;
      ACTION ( If( ! Empty( cDbfName ) .and. Len( aFields ) > 0,;
          DbCreate( AllTrim( cDbfName ), aFields ),), oDlg:End(),;
          lCopy := .T.,;
          oBrwNew := Open( hb_CurDrive() + ":\" + CurDir() + "\" + AllTrim( cDbfName ) ) )

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( Eval ( bChange ), oBtn:Disable() ) ;
      VALID ! GETKEYSTATE( VK_ESCAPE )

   if ! Empty( cAlias ) .and. lCopy
      APPEND FROM ( cFileName )
      oBrwNew:Refresh()
   endif

return nil

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

function AddField( aFields, cFieldName, cType, nLen, nDec, oGet, oBrw )

   local cSymbol     := "
"
   if Empty( cFieldName )
      oGet:SetPos( 0 )
      return nil
   endif



   /* Harbour extended field types https://vivaclipper.wordpress.com/2012/ ... n-harbour/ */
   if Upper( Left( cType, 1 ) ) = "
A"
      cType :=  "
+"

   elseif cType == "
ModTime"
      cType :=  "
="

   else
      cType := Upper( Left( cType, 1 ) )

   endif



   if Len( aFields ) == 1 .and. Empty( aFields[ 1 ][ 1 ] )
      aFields = { { cFieldName, cType, nLen, nDec } }
   else
      AAdd( aFields, { cFieldName, cType, nLen, nDec }  )
   endif

   oBrw:SetArray( aFields )
   oGet:VarPut( cFieldName := Space( 10 ) )
   oGet:SetPos( 0 )
   oGet:SetFocus()
   oBrw:GoBottom()

return nil

//----------------------------------------------------------------------------//
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am


Return to FiveWin for Harbour/xHarbour

Who is online

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