Multi dimensional Array, aSave, aRead

Post Reply
devtuxtla
Posts: 392
Joined: Tue Jul 29, 2008 1:55 pm

Multi dimensional Array, aSave, aRead

Post by devtuxtla »

Hello Fivewinners.

I require save and read in a memo field, multi dimensional array, I  try saving with aRead aSave and read it, but send me the following error:

    Time from start: 0 hours 1 mins 39 secs
    Error occurred at: 11/11/2013, 12:24:18
    Error description: Error BASE/1131 Bound error: array dimension
    args:
      [1] = N -4799

Stack Calls
===========
    Called from: => Array (0)
    Called from:. \ Source \ classes \ WINDOW.PRG => aread (1816)
    Called from: C: \ Activities \ prg \ actividadxml08.prg => AV_GENERA_R08 (874)


I am using xHarbour 1.23 and Fw1308

Someone knows the trick?

regards
Visite Chiapas, el paraiso de México.
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Re: Multi dimensional Array, aSave, aRead

Post by Gale FORd »

I use valtoprgexp()

replace MemoField with valtoprgexp( aData )

then later

aData := &( MemoField )

This may be a xHarbour.com function but I am not sure.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Multi dimensional Array, aSave, aRead

Post by Antonio Linares »

Gustavo,

Que versión de FWH estás usando ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
TecniSoftware
Posts: 213
Joined: Fri Oct 28, 2005 6:29 pm
Location: Quilmes, Buenos Aires, Argentina

Re: Multi dimensional Array, aSave, aRead

Post by TecniSoftware »

Yo uso desde hace muchisimo tiempo _ memo guardando arrays multidimensionales sin hacer absolutamente ninguna formula ni nada.

Simplemente creo el campo como memo AADD(aDbf,{"ITEMS", "M", 10, 0}) y luego le asigno el array que necesito:

aItems[n][1] // Fecha
aItems[n][2] // Código de concepto
aItems[n][3] // Número de cuota
aItems[n][4] // Vencimiento
aItems[n][5] // Debe
aItems[n][6] // Haber

Replace (cAlias)->Items With aItems

Despues se puede recorrer el array

For n := 1 To Len( (cAlias)->Items
MSgInfo( (cAlias)->Items[n][1] )
MSgInfo( (cAlias)->Items[n][2] )
MSgInfo( (cAlias)->Items[n][3] )
...
....
Next

No se si es esto lo que estas necesitando.
Espero que te sirva.

Saludos
Alejandro Cebolido
Buenos Aires, Argentina
devtuxtla
Posts: 392
Joined: Tue Jul 29, 2008 1:55 pm

Re: Multi dimensional Array, aSave, aRead

Post by devtuxtla »

Hola Antonio.

Estoy utilizando la version 13.08.

Alejandro, Gracias por el Tip, por ahora lo resolvi asi, como lo comentas.

Saludos
Visite Chiapas, el paraiso de México.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Multi dimensional Array, aSave, aRead

Post by nageswaragunupudi »

I am not discussing about ARead and ASave, but like to discuss some alternatives.

#1) If we are using "DBFCDX", we need not make any conversions. We can straightaway assign and read Arrays to and from memo fields very safely.

(cAlias)->MEMOFLD := aData
and
aData := (cAlias)->MEMOFLD

Works very well and reliably for any complex arrays nested to any level.

Cons: Does not work with DBFNTX or ADSCDX.

#2) I personally recommend using FW_ValToExp( aData ) over using VALTOPRGEXP().

By using FW_ValToExp() we are confident that values written in xHarbour can be correctly ready by Harbour and vice-versa.

We had to write FW_ValToExp() when we faced some issues using ValToPrg().
Regards

G. N. Rao.
Hyderabad, India
Post Reply