Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy to array gives different results to 'scatter memvar'
Message
From
22/07/1999 06:03:54
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Copy to array gives different results to 'scatter memvar'
Miscellaneous
Thread ID:
00244588
Message ID:
00244588
Views:
38
I'm trying to provide an option for users to selectively track changes to important files. This is what we've got...

IF AUDITING && user option to track changes to selected files
COPY TO ARRAY TEMVAR RECORD(RECNO()) && the unchanged record
&& (Note 'Scatter to Temvar' doesn't seem to work any differently in this context)
ENDIF
GATHER MEMVAR MEMO && store the changes in the table being tracked
IF AUDITING
IF TYPE('AUDFILE')='L' && the file recording changes hasn't been defined yet
AUDFILE=TRIM(AUDITPATH+ALIAS())+'.DBF' && auditpath is the directory we store the audit files in
ENDIF
IF FILE(AUDFILE)
INSERT INTO &AUDFILE FROM ARRAY TEMVAR && the original version
INSERT INTO &AUDFILE FROM MEMVAR && the changed version
ENDIF
ENDIF


I find that the array version is consistently screwed up! The data seems to be shunted along a couple of fields making the record useless.

I find also that I get exactly the same results if I switch from 'insert into' to the slower and more long winded 'append blank/gather' alternative.

Is this just me?

If not, is it documented anywhere and is there a fix?

The one pattern I have noticed is that the copy/scatter to array version can't seem to handle memo fields and that some of its shunting is caused by its skipping such fields. But even if I reorder the fields and place memos at the end of the table, although this improves things slightly, the shunting still happens.

Incidentally, if I run a test manually from the command window, it works perfectly! So the problem must be caused by something in my application environment. Even a suggestion on how to debug it would be extremely welcome!

I have watched the values of 'temvar' in the debugger prior to and after the insertion and compared them field by field with the original record and they match exactly. Its only in the 'audit' table itself that the values are screwed up...

(the audit table starts off as a blank copy of the table being audited so its structure is identical)

Finally, although I would welcome advice along the lines of 'there is a much better way to do this in vfp' I would still like some insight into why those few simple lines don't do the job as anticipated.

Harry
Next
Reply
Map
View

Click here to load this message in the networking platform