Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Re-order sno
Message
From
18/12/2017 23:28:05
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 10
Network:
Windows Server 2008 R2
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01656489
Message ID:
01656526
Views:
42
>>Dear Sir,
>>
>>I have these codes
>>
>>
>>CREATE CURSOR junk (sno n(3),amount n(6))
>>INSERT INTO junk VALUES (1,500)
>>INSERT INTO junk VALUES (2,600)
>>INSERT INTO junk VALUES (3,700)
>>INSERT INTO junk VALUES (5,800)
>>INSERT INTO junk VALUES (6,900)
>>INSERT INTO junk VALUES (7,1000)
>>INSERT INTO junk VALUES (8,1100)
>>INSERT INTO junk VALUES (10,1200)
>>INSERT INTO junk VALUES (11,1300)
>>
>>
>>
>>
>>
>>
>>
>>
>>In sequence, if found any missing sno then replace the maximum number of sno with missing sno.
>>
>>In the above example sno=4 is missing and maximum sno is 11
>>so sno 11 is being replaced with sno 4 and so on.
>>
>>
>>Please help
>
>In your sample you have 4 and 9 missing. What exactly do you want to do? Can you show the desired output?



That codes work fine
For i=1 To Reccount('junk')
	Locate For sno=m.i
	If !Found()
		MAXSNO1=0
		Calculate Max(sno)To MAXSNO1
		Replace sno With m.i For sno= MAXSNO1
	Endif
Endfor
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform