Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Attempted the correction..however...
Message
From
16/08/2001 10:49:38
N. Lea
Nic Cross Enterprises
Valencia, California, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Attempted the correction..however...
Miscellaneous
Thread ID:
00544703
Message ID:
00544703
Views:
46
I attempted the correction with the REPLACE FOR command; however, it did not seem to work. It seems as if I do need the SCAN....ENDSCAN code. My printorder still is still off.

>>I am running into a problem with my code. It works, but it does not work. This code seems to be fine when I need to move any printorder # < 8. However, when I attempt to move anything greater than that, it works like this. I move 13 and change it's number to 10.
>>
>>8
>>9
>>10
>>11
>>12
>>13
>>
>>8
>>9
>>10
>>11
>>12
>>12
>>13
>>
>>I just do not understand why it only works under certain condition. Any suggestions? Thanks for any help!
>>
>>
>>
>Two obvious observations: you don't need to use FILTER command in your replace. Just do replace FOR.
>You probably don't need to use scan at all too, just use REPLACE FOR syntax again. It would be faster, easier to follow and would not contain problems...
>Or at least don't use recno() in scan condition.
>
>
>
>>

>>WITH THISFORM
>> lContinue = .F.
>>
>> **--STORES INFO FROM TABLE--**
>> nNewPrintOrder = ROUND(VAL(SPACE(3)),0) && Stores new value
>> nOldValue = report1.printorder
>> nRecordNo = RECNO()
>>
>> ** MARKS RECORD TO MOVE **
>> REPLACE report1.printorder WITH -1
>>
>> ** THIS FORM BRINGS OVER nNewPrintOrder INTO SPACE VARIABLE **
>> DO FORM gl_pnl_neworder
>>
>> ** REPLACES -1 RECORD WITH NEW VALUE FROM nNewPrintOrder **
>> SELECT report1
>> SET FILTER TO printorder = -1
>> REPLACE ALL printorder WITH nNewPrintOrder
>> SET FILTER TO
>>
>> IF lContinue = .T.
>> ** IF NEW # IS GREATER THAN OLD # DO SCAN 1 **
>> IF nNewPrintOrder > nOldValue
>> SELECT report1
>> nResetPrintOrder = 1
>> SCAN FOR printorder <= nNewPrintOrder AND RECNO()<>nRecordNo
>> REPLACE printorder WITH nResetPrintOrder
>> nResetPrintOrder = nResetPrintOrder + 1
>> ENDSCAN
>> ELSE
>> ** IF NEW # IS LESS THAN OLD # DO SCAN 1 **
>> SELECT report1
>> nResetPrintOrder = nNewPrintOrder + 1
>> SCAN FOR printorder >= nNewPrintOrder AND RECNO()<>nRecordNo
>> REPLACE printorder WITH nResetPrintOrder
>> nResetPrintOrder = nResetPrintOrder + 1
>> ENDSCAN
>> ENDIF
>> .grdPnLChart.Refresh()
>> GO TOP
>> ENDIF
>>
>>ENDWITH
>>
Next
Reply
Map
View

Click here to load this message in the networking platform