Page 1 of 1

Multi dimensional Array, aSave, aRead

Posted: Mon Nov 11, 2013 6:32 pm
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

Re: Multi dimensional Array, aSave, aRead

Posted: Mon Nov 11, 2013 8:35 pm
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.

Re: Multi dimensional Array, aSave, aRead

Posted: Tue Nov 12, 2013 8:47 am
by Antonio Linares
Gustavo,

Que versión de FWH estás usando ?

Re: Multi dimensional Array, aSave, aRead

Posted: Tue Nov 12, 2013 12:14 pm
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

Re: Multi dimensional Array, aSave, aRead

Posted: Sun Nov 17, 2013 4:17 pm
by devtuxtla
Hola Antonio.

Estoy utilizando la version 13.08.

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

Saludos

Re: Multi dimensional Array, aSave, aRead

Posted: Wed Nov 20, 2013 1:15 pm
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().