Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Number Resequence Problem...?
Message
From
26/09/2001 10:16:06
N. Lea
Nic Cross Enterprises
Valencia, California, United States
 
 
To
26/09/2001 09:40:56
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00560912
Message ID:
00560947
Views:
23
All I am trying to do it create a renumbering sequence with a right click event. I cannot use a drag drop at this moment to renumber items. This process is so that I can just move items under different categories by printorder:

1 Taxes -> 1 Taxes
2 Education -> 2 Benefits
3 World -> 3 Education
4 Employee -> 4 World
5 Benefits -> 5 Employee

I attempted to release the printorder with my code by adding a set order to at the start of the scan and creating it again at the end of the scan, but it still did not work.



>To be honest I don't really understand what you're doing.. but
>one thing that did stand out in your post was the following
>
>If your table is indexed on Printorder (and this index is currently active)
>when you replace printorder with another value your current position in the table will jump to the newly indexed position, so doing this in a scan looop could cause unexpected results. maybe it will process some records twice or some not at all.
>
>I suspect you should get rid of the order before doing the scan
>
>HTH
>Will
>
>>Good morning all!! I have a situation with a renumbering sequence problem. My code seems to be right, and it works are far as an open table through the command window. As I have it, my table called plfile is order by a field called PrintOrder N(3). There are currently 31 records in this table. On the form, this table is accessed through a grid called grdFinancialChart. The code that executes this renumbering sequence is located in the right-click event. The problem that I am having is that when trying to change the printorder from current value of 12 to the new value of 6, somewhere along the line (usually when the value is 2 digits), the system skips a record and thus a value is duplicated in the printorder field. 1,2,3,4,5,6,7,8,9,10,10,11,12,13,14...etc
>>
>>Here is the code that is executed in the right click of the grid column for printorder. The form that is being executed in the code is a ghost form with only a textbox and button which has a controlsource of a variable which is carried out through the code:
>>
>>
WITH THISFORM	
>> lContinue = .F.
>>
>> && STORES INFO FROM DATABASE
>> nNewPrintOrder = ROUND(VAL(SPACE(5)),0)
>> nOldValue = plfile.printorder
>> nRecordNo = RECNO()
>> MESSAGEBOX("RECORD#" + ' '+ STR(RECNO()),0)
>>
>> DO FORM gl_pnl_neworder
>>
>> GOTO nRecordNo
>> REPLACE plfile.printorder WITH nNewPrintOrder
>>
>> IF lContinue = .T.
>> **OLD # 4 and NEW is 7
>> IF nNewPrintOrder >= nOldValue
>> nResetPrintOrder = 1
>> SCAN FOR printorder <= nNewPrintOrder AND RECNO () <>nRecordNo
>> REPLACE printorder WITH nResetPrintOrder
>> nResetPrintOrder = nResetPrintOrder + 1
>> ENDSCAN
>> ELSE
>> MESSAGEBOX("RECORD#" + ' '+ STR(RECNO()),0)
>> nResetPrintOrder = nNewPrintOrder + 1
>> SCAN FOR printorder >= nNewPrintOrder AND RECNO()<>nRecordNo
>> REPLACE printorder WITH nResetPrintOrder
>> nResetPrintOrder = nResetPrintOrder + 1
>> ENDSCAN
>> ENDIF
>>
>> .grdFinancialChart.Refresh()
>> ENDIF
>>
>> THISFORM.mPLRecalculate()
>> GO TOP
>>ENDWITH
>>

>>
>>Thanks for any help or assistance with this problem that is haunting me!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform