FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Save and Read Arrays
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM

Save and Read Arrays

Posted: Wed Feb 11, 2009 10:41 PM

I built a program and used the following code to save an array to a memo field:

// Convert the parts array to a memo string
cQuoPts := aSave( aQuoPar )

And the following line to put it back into an array:

  // Convert the memo string to a parts array
  aQuoPar := aRead( oQuo:quopts )

It all worked fine when built with 8.10 FWH.

Now, with 8.12 FWH I can't get the data back. At first I received an error on the array limits, and now I just get no data showing.

Any thoughts ?

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM

Re: Save and Read Arrays

Posted: Wed Feb 11, 2009 11:29 PM
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM

Re: Save and Read Arrays

Posted: Wed Feb 11, 2009 11:39 PM

I see that, but in FWH 8.10 it's npos = 1, and 8.12 it's npos = 4. Which is correct ?

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 782
Joined: Wed Dec 19, 2007 07:50 AM

Re: Save and Read Arrays

Posted: Thu Feb 12, 2009 04:01 AM
Hi Tim:

Here you are a little working sample of storing an array into a database memo field without any conversion.
#include "Fivewin.ch"

REQUEST DBFCDX, DBFFPT

Function Main()

   Local oGet, oDlg, aStr, aNew, ;
         aTest := { { "Hello ", .T., "World" }, { "It is ", 25, " Euros" } }

   aStr := { { "One", "C", 10, 0 }, { "Two", "M", 10, 0 } }

   DbCreate( "TestMemo.dbf", aStr, "DbfCdx" )
   use ( "TestMemo" ) Excl New Via "DbfCdx"

   APPEND BLANK
   Replace One With "Test1", Two With aTest
   DbCloseAll()

   use ( "TestMemo" ) Excl New Via "DbfCdx"

   MsgInfo( TestMemo->One + CRLF + ;
            If( TestMemo->Two[ 1, 2 ], TestMemo->Two[ 1, 1 ] + TestMemo->Two[ 1, 3 ], "" ) + CRLF + ;
            TestMemo->Two[ 2, 1 ] + LTrim( Str( TestMemo->Two[ 2, 2 ] ) ) + TestMemo->Two[ 2, 3 ] )

   DbCloseAll()
   FErase( "TestMemo.dbf" )

Return Nil

As you can see not only an array can be stored in a memo field with no conversion, but also refer to memo field in the same way you refer to an actual array.

I sincerely don't know how but it works.

Regards.

Manuel Mercado.
manuelmercado at prodigy dot net dot mx
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM

Re: Save and Read Arrays

Posted: Thu Feb 12, 2009 09:38 AM

Tim, the 4 are right!

Regards,
Günther
---------------------------------
office@byte-one.com

Continue the discussion