Tenho esta função a bastante tempo, mas não lembro quando a usei portanto acho que é assim:
USE clientes SHARED NEW
aMeusDados := CopyToArray( { "NOME", "ENDERECO", "CEP" },
"ESTADO = 'SP'" )
function CopyToArray( PablkCampos, PblkFor, PBlkWhile )
local cNumCampos := len(PablkCampos)
local aVetor := {}
local Tx
for Tx = 1 to cNumCampos
aadd( aVetor, {} )
next
PblkFor := iif( PblkFor=NIL , {||.t.}, PblkFor )
PBlkWhile := iif( PBlkWhile=NIL, {||.t.}, PBlkWhile )
do while !eof() .and. eval(PBlkWhile)
if eval( PBlkFor )
Tx := 0
for Tx = 1 to cNumCampos
aadd( aVetor[Tx], eval(PablkCampos[Tx]) )
next
endif
skip
enddo
return aVetor