Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GATHER FROM ArrayName MEMO bug
Message
From
03/08/2000 15:20:41
Paul Mender
Mender Software Development
Edgewater, Colorado, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
GATHER FROM ArrayName MEMO bug
Miscellaneous
Thread ID:
00400647
Message ID:
00400647
Views:
77
Problem:
When gathering the contents of an array to a memo field using the GATHER FROM ArrayName MEMO command, only the first row of the array is gathered.

The program below illustrates the problem. I searched the UT for the last couple years and did not find a similar report. Has anyone else experienced this problem?

Any insight into this matter is much appreciated.

*----------------------------------------------------------------
* Program: GATHERBUGCHECK.PRG
* Author: Paul K. Mender
*----------------------- Usage Section --------------------------
*) Description:
*) Demonstrates a bug in GATHER FROM array.
* Parameters:
* None
*$ Usage:
*$ DO Gatherbugcheck
* Returns:
*--------------------- Maintenance Section ----------------------
* Notes:
*
* Change Log:
* CREATED August 3, 2000 11:11:51 - PKM
******************************************************************
#DEFINE cBUGCHECK_DBF BugCheck.DBF
#DEFINE ccBUGCHECK_DBF "BugCheck.DBF"
#DEFINE ccBUGCHECK_ALIAS "BugCheck"

*-- Define the array for ALINES() as public. (This works?)
RELEASE gaLines
PUBLIC ARRAY gaLines[1]

*-- Define the array for ALINES() as local. (This doesn't work?)
LOCAL ARRAY laLines[1]

LOCAL ;
lcAlias,;
lcMemoContents,;
lcMsg,;
lcSetSafety,;
liI,;
lnLocalLines,;
lnMemoLines,;
lnNewMemoLines,;
lnPublicLines

lcSetSafety = SET("SAFETY")
SET SAFETY OFF

lcAlias = ccBUGCHECK_ALIAS

IF USED(lcAlias)
USE IN &lcAlias
ENDIF

IF FILE(ccBUGCHECK_DBF)
DELETE FILE ccBUGCHECK_DBG
ENDIF

CREATE TABLE cBUGCHECK_DBF (mSomeMemo M)
USE cBUGCHECK_DBF ALIAS &lcAlias EXCLUSIVE
IF USED(ccBUGCHECK_ALIAS)

SELECT (lcAlias)

ZAP

APPEND BLANK
*-- Populate the mSomeMemo field
lnMemoLines = 10 && some arbitrary number of lines
lcMemoContents = ""
FOR lii = 1 TO lnMemoLines
lcMemoContents = lcMemoContents;
+"Memo line "+ALLTRIM(STR(liI))+CHR(13)
ENDFOR &&* lii = 1 TO 10
REPLACE NEXT 1 mSomeMemo WITH lcMemoContents

*-- Use the public array.
lnPublicLines = ALINES(gaLines,mSomeMemo,.T.)

*-- Use the local array.
lnLocalLines = ALINES(laLines,mSomeMemo,.T.)

*-- I originally thought that this was the
*-- cause of the problem. - PKM
IF lnPublicLines<>lnLocalLines
lcMsg = "ALINES returned different number of lines."
= MESSAGEBOX(lcMsg+CHR(13);
+"Local Array: "+ALLTRIM(STR(lnLocalLines));
+" Public Array: "+ALLTRIM(STR(lnPublicLines));
)
ENDIF

IF lnMemoLines<>lnLocalLines
lcMsg = "LOCAL ALINES returned different number of lines."
= MESSAGEBOX(lcMsg+CHR(13);
+"Local Array: "+ALLTRIM(STR(lnLocalLines));
+" memo lines: "+ALLTRIM(STR(lnMemoLines));
)
ENDIF

*-- ... replace the contents of the memo field
*-- from the local array.
GATHER FIELDS mSomeMemo FROM laLines MEMO

MODIFY MEMO mSomeMemo NOWAIT NOEDIT

lnNewMemoLines = ALINES(laNewLines,mSomeMemo,.T.)
IF lnNewMemoLines <> lnMemoLines
= MESSAGEBOX("Error! Memo lines were not completely restored."+CHR(13);
+"("+ALLTRIM(STR(lnNewMemoLines))+ " versus ";
+ ALLTRIM(STR(lnMemoLines)+")"))
ENDIF

USE IN &lcAlias
ENDIF

SET SAFETY &lcSetSafety

RETURN
Next
Reply
Map
View

Click here to load this message in the networking platform