In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

How to change dbf Structure

Xailer English public forum
Responder
chiragsoni
Mensajes: 2
Registrado: Mar Feb 22, 2011 11:14 am

How to change dbf Structure

Mensaje por chiragsoni »

Hello,
Is there any method or function To Change DBF Stucture, Add/Modify Data Field.
Avatar de Usuario
Carlos Ortiz
Mensajes: 873
Registrado: Mié Jul 01, 2009 5:44 pm
Ubicación: Argentina - Córdoba
Contactar:

How to change dbf Structure

Mensaje por Carlos Ortiz »

DbStruct()
Loads structural information of a database into an array.
Syntax
DbStruct() --> aStructure
Return
DbStruct() returns a two-dimensional array of four columns, filled with
structural information of a database.
Description
The DbStruct() function returns a two-dimensional array with FCount()
elements. Each element, again, contains a sub-array with four elements
holding information about each field of the database open in the current
work area. The elements in the sub-arrays can be accessed using #define
constants found in the DBSTRUCT.CH file.
Constants for the DbStruct() array Constant Value Meaning
DBS_NAME 1 Field name
DBS_TYPE 2 Field type
DBS_LEN 3 Field length
DBS_DEC 4 Field decimals
Example
// The example is the code for a useful command line utility
// that lists the database structure in a shell window.
#include "DbStruct.ch"
PROCEDURE Main( cDbfFile )
LOCAL aStruct
IF Empty( cDbfFile ) .OR. .NOT. File( cDbfFile )
CLS
? "Usage: dbstruct.exe <dbf file>"
QUIT
ENDIF
USE (cDbfFile)
aStruct := DbStruct()
AEval( aStruct, {|a| QOut( PadR( a[DBS_NAME], 10 ), ;
a[DBS_TYPE] , ;
Str( a[DBS_LEN ], 3 ), ;
Str( a[DBS_DEC ], 3 ) ;
) } )
USE
RETURN
chiragsoni
Mensajes: 2
Registrado: Mar Feb 22, 2011 11:14 am

How to change dbf Structure

Mensaje por chiragsoni »

Thank You,
But I Want To Modify Structure without deleting existing dbf file. There are so many records. Now i want to Add a New Field.
Please Help...
Responder