Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Strange behavior using REPLACE command
Message
From
06/06/2003 10:55:59
 
 
To
06/06/2003 10:50:22
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00797167
Message ID:
00797263
Views:
17
Is there any kind of scoping or conditionals in the REPLACE command? Have you tried REPLACE NEXT 1 for scoping once you are at the correct record. Can we see the REPLACE command?

>Mike,
>
>Thanks for replying.
>
>Go Top? I assume you mean just for testing purposes? I wouldn't want to do a GO TOP after each append and them relocate my record for updating. There is no ORDER set on the table.
>
>The sequence of events in my code is
>1. select the target table
>2. Zap it
>3. while doing a low level file read for each line in a text file, APPEND BLANK and update the target table with character strings (using REPLACE) until I reach EOF of the text file. There is no source table, so my syntax is simply REPLACE fieldname with value IN Target (without the alias.fieldname)
>
>>If you start out at EOF, you wouldn't get any replaces. Browsing would move the record pointer artificially. Try a go top after the append.
>>
>>Is there an ORDER set on the target table? Changing a record with the order active can result in the changed record becoming the last record in that sequence and the replace would stop. Try SET ORDER TO.
>>
>>Are you using REPLACE targetalias.field with sourcealias.field in targetalias? You need not preface the target field.
>>
>>>By the way, I ran the same code on another machine networked to the same data and the results are the same.
>>>
>>>>I'm a little sheepish posting this, but I am experiencing wierd behavior which is kicking my butt, so I need some input.
>>>>
>>>>I'm using a procedure call from a screen that is importing data to a non-buffered table. I'm using a simple method of APPEND BLANK to my target table and then using REPLACE field WITH value IN TARGETTABLE. My APPEND BLANK is working and my table is populated with primary keys being generated in my DBC code. However, NONE of my replace statements are populating the table. The target table is completely blank except for the primary key values. Here are some conditions:
>>>>
>>>>-The table is not buffered, confirmed with both CURSORGETPROP('buffering') and attempting a TABLEUPDATE, which fails since table is not buffered.
>>>>-The target table is selected during the REPLACE commands(which shouldn't matter anyways, I'm using REPLACE IN tablename
>>>>-The correct datasession is active
>>>>-I reindexed the table, no effect
>>>>-ERROR handling is turned off, and I'm not getting any error messages on any REPLACE commands (confirmed running through debugger).
>>>>-This is where it gets wierd, if I run the code in the debugger and in the middle of the REPLACE statements I BROWSE the table, then the fields begin to get populated with values as I continue to STEP through the REPLACE commands. If I close the browse and continue on, then the table is not getting updated past that point when I closed the browse. However, any values that were entered while the browse was active still remained saved in the table.
>>>>-If I simply open up the table all by itself in a VFP session and issue append blanks and REPLACE in the command window, the table is updating correctly
>>>>-Not sure if it's relative, but I've gotten an occasional internal consistancy error over the last week in VFP.
>>>>-I'm using VFP6.0 and XP
>>>>
>>>>Perhaps it's time to reinstall VFP?
>>>>
>>>>Thanks in advance.
>>>>
>>>>Jim
Previous
Reply
Map
View

Click here to load this message in the networking platform