Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scan endscan skipping last record
Message
From
14/02/2003 14:12:25
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Scan endscan skipping last record
Miscellaneous
Thread ID:
00753383
Message ID:
00753383
Views:
70
I have a scan/endscan loop that I am using to update records in a table. The routine works fine until the last record. It skips updating the last record, no matter how many records It processes. I am using scatter/gather to update the records. I placed a wait window just before the gather, so I know the loop is executing on the last pass, and I know that the variables exist in memory. It's as if the table doesnt get updated until after the loop begins again???

I had a similar situation some time ago, but I was appending records. I placed a "GO BOTTOM" command just before the gather and it solved the problem. Obviously, I can't do that here since I'm not appending records. I tried a "GO RECNO()" but that didnt help. I'm just not understanding why it's skipping the last update. My code Follows:
SELECT 'diecmm'
GO TOP IN 'diecmm'
SCAN FOR !(diecmm.imported)
*replace diecmm.imported WITH .t.
SCATTER memvar
SELECT 'dieactualdata'
LOCATE FOR dieactualdata.jobnum=m.jobnum AND dieactualdata.itemnum=m.itemnum
IF FOUND()
IF m.atd1>0
SELECT 'dieparams'
LOCATE FOR dieparams.jobnum=m.jobnum
IF FOUND()
m.atl1=dieparams.tl1/2
IF m.atd2>0
m.atl2=dieparams.tl2/2
endif
ELSE
thisform.omessage.warning('Parameters are missing for: '+ALLTRIM(m.jobnum))
endif
ENDIF
SELECT 'dieactualdata'
WAIT STR(m.itemnum)+' '+STR(m.aol,8,5) window
GATHER memvar
ELSE
lcError=lcError+CHR(040)+ALLTRIM(diecmm.jobnum)+CHR(032)+ALLTRIM(STR(diecmm.itemnum))+CHR(041)+ CHR(032)
endif
ENDSCAN

IF !EMPTY(lcError)
thisform.omessage.warning('Actual data records were missing, so the import failed for: '+ALLTRIM(lcError))
endif
Next
Reply
Map
View

Click here to load this message in the networking platform