I am trying get the field structure form inside a program. I know it is easy but can not find.
use table
msgbox(field1(name))
msgbox(field1(type))
msgbox(field1(length))
msgbox(field2(name) and so on.
field length, type,
Moderator: Rathinagiri
field length, type,
All The Best,
Franco
Canada
Franco
Canada
- SALINETAS24
- Posts: 667
- Joined: Tue Feb 27, 2018 3:06 am
- DBs Used: DBF
- Contact:
Re: field length, type,
Hola Franco. ¿Quieres leer la estructura de un DBF...?
aField:=Alias->(DBSTRUCT() )
aField[1]:= nombre
aField[1]:= tipo
aField[1]:= longitud
aField[1]:= decimales
Tambien puedes usar esta otra funcion
Alias-> AFIELDS(aNombre,aTipo,aLongitud,aDecimales)
Un saludo,
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. 

Re: field length, type,
SALINETAS24,
No I need to know the type of field1, field2 and so on
field 1 is 'ITEM' C
field 2 is DESC C
field 3 is PRICE N
in program
if ITEM(type) = 'C' // will index
index
endif
if PRICE(type) = 'C' //will not index
index
endif
No I need to know the type of field1, field2 and so on
field 1 is 'ITEM' C
field 2 is DESC C
field 3 is PRICE N
in program
if ITEM(type) = 'C' // will index
index
endif
if PRICE(type) = 'C' //will not index
index
endif
All The Best,
Franco
Canada
Franco
Canada
- SALINETAS24
- Posts: 667
- Joined: Tue Feb 27, 2018 3:06 am
- DBs Used: DBF
- Contact:
Re: field length, type,
Ahora te he entendido ...,

necesitas VALTYPE()
Code: Select all
LOCAL nLen := Alias->( FCount() )
LOCAL aData:={}
FOR n = 1 TO nLen
AAdd( aData, FieldGet( n ) )
MSGBOX(aData[n])
MSGBOX(VALTYPE(aData[n])
NEXT
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. 

Re: field length, type,
Thanks SALINETAS24, I new it would be easy.
msgbox(valtype(fieldget(3)))
msgbox(valtype(desc)) field(2)
Franco
msgbox(valtype(fieldget(3)))
msgbox(valtype(desc)) field(2)
Franco
All The Best,
Franco
Canada
Franco
Canada