save an array on text
Posted: Wed May 13, 2020 10:52 am
I need to save on source code a big dbf
I'm thinking to save an array without use the dbf
I tried to make a test but it not run ok
where is the error ?
I'm thinking to save an array without use the dbf
I tried to make a test but it not run ok
where is the error ?
Code: Select all
#include "fivewin.ch"
Function test()
local aData:={}
local cCode := ""
USE CUSTOMER ALIAS CUSTOMER
aData:=CUSTOMER->(FW_DbfToArray())
cCode:=PrintArray( adata, .T. )
MemoEdit( cCode, FWString( "Code" ) )
return nil
//-------------------------------------------------------------------------//
Function PrintArray( arr, lNoNewLine )
Local i
local ctxt:=""
IF lNoNewLine == Nil .OR. !lNoNewLine
ctxt:="error"
ENDIF
ctxt+= " {"
FOR i := 1 TO Len( arr )
IF Valtype( arr[i] ) == "A"
PrintArray( arr[i], .T. )
ELSE
ctxt+= " " + Iif( Valtype( arr[i] ) == "N", ltrim(Str(arr[i])), ;
Iif( Valtype( arr[i] ) == "D", Dtos(arr[i]),arr[i]) )
ENDIF
NEXT
ctxt+= " }"
Return ctxt