TIP: Click on subject to list as thread! ANSI
echo: clipper
to: BONG BENITEZ
from: BEN CAVANAGH
date: 1997-06-24 21:00:00
subject: Adding Fields in Clipper

BB>>Hello ALL!
     Hi Bong,
BB>>How do I write a program that adds fields to an existing .DBF
BB>>without using DBU.EXE
BB>>First the program will detect the NAME.DBF if the new fields are
BB>>present. If not the new fields will be added.
    I'm sure that they are better solution that what I found but I post you
    something to try. I hope that it will help you !
//-------------------------------------------------------------------------
procedure Filz()
  use NAME
  if (fcount() = 3)  // Not own ADDRESS1 and ADDRESS2
     aDBF:= {}
     aadd (aDBF,{"LASTNAME",  "C", 10, 0})
     aadd (aDBF,{"FIRSTNAME", "C", 10, 0})
     aadd (aDBF,{"MID",       "C", 1,  0})
     aadd (aDBF,{"ADDRESS1",  "C", 40, 0})
     aadd (aDBF,{"ADDRESS2",  "C", 40, 0})
     dbcreate ('TEMP.DBF', aDBF)
  endif
  FixFile ()
return
//-------------------------------------------------------------------------
procedure FixFile()
  select 1
  use NAME
  select 2
  use TEMP
  select 1
  go top
  do while .not. eof()
    select 2
    append blank
    replace LASTNAME  with 1->LASTNAME
    replace FIRSTNAME with 1->FIRSTNAME
    replace MID       with 1->MID
    select 1
    skip
  end
  ferase ('NAME.DBF')
  rename ('TEMP.DBF') to ('NAME.DBF')
return
--- FidoPCB v1.5 beta-'e'
---------------
* Origin: Innovatron, St-Boniface, QC (819)535-9072 (1:167/420)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.