Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SCAN ..... ENDSCAN
Message
From
21/06/2001 11:23:25
 
 
To
21/06/2001 07:57:47
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00521771
Message ID:
00521947
Views:
12
Here is a rewrite of your code:
i=1 && i = counter variable
c=0 && c is initialised to 0
SCAN
	IF c=VAL(village)
		i=i+1 && <<<===== Your error "i=1+1"
	ELSE
		i=1
		c=VAL(village)
	ENDIF 
	REPLACE ccount WITH i && value of i is assigned to the variable ccount
ENDSCAN
If village is treated as a numeric, why isn't the village column of type numeric? If it is a compound field (eg. "1 Village Name"), you should create a village table ( vcode i, vname c(24) ) and village in your main table with vcode.

The column name "ccount" seems inappropriate for how the column is used, I suggest "corder" or "csequence".

When is this ccount used? I seems that the ccount of any row could change after an insert, delete, sort, or set index. You should consider Mark's SQL.

>What I have is a code like this:
>
>
>GO TOP
>i=1 && i = counter variable
>c=0 && c is initialised to 0
>IF RECNO()=1
>c=VAL(village) &&c is assigned the first value of the village for the first rec ENDIF
>SCAN
> REPLACE ccount WITH i && value of i is assigned to the variable ccount
> IF c=VAL(village)
> i=1+1
> ELSE
> i=1
> ENDIF
> c=(village)
>ENDSCAN
>
>
>Tell me what I'm doing wrong here ....... coz I want the value of ccount to be incremented until the value of the village changes and i starts counting again from 1 til the next village etc etc ....
>
>Thanks,
>Richard.
Previous
Reply
Map
View

Click here to load this message in the networking platform