Multi dimensional Array, aSave, aRead

Multi dimensional Array, aSave, aRead

Postby devtuxtla » Mon Nov 11, 2013 6:32 pm

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.
devtuxtla
 
Posts: 392
Joined: Tue Jul 29, 2008 1:55 pm

Re: Multi dimensional Array, aSave, aRead

Postby Gale FORd » Mon Nov 11, 2013 8:35 pm

I use valtoprgexp()

replace MemoField with valtoprgexp( aData )

then later

aData := &( MemoField )

This may be a xHarbour.com function but I am not sure.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Multi dimensional Array, aSave, aRead

Postby Antonio Linares » Tue Nov 12, 2013 8:47 am

Gustavo,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42094
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Multi dimensional Array, aSave, aRead

Postby TecniSoftware » Tue Nov 12, 2013 12:14 pm

Yo uso desde hace muchisimo tiempo los campos 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
User avatar
TecniSoftware
 
Posts: 235
Joined: Fri Oct 28, 2005 6:29 pm
Location: Quilmes, Buenos Aires, Argentina

Re: Multi dimensional Array, aSave, aRead

Postby devtuxtla » Sun Nov 17, 2013 4:17 pm

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.
devtuxtla
 
Posts: 392
Joined: Tue Jul 29, 2008 1:55 pm

Re: Multi dimensional Array, aSave, aRead

Postby nageswaragunupudi » Wed Nov 20, 2013 1:15 pm

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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 80 guests