Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

indexing in loops 1

Status
Not open for further replies.

sdpsc

Technical User
Joined
Feb 10, 2001
Messages
76
I want the below code to loop through each field and index in (thus showing the unique count for each field). But it just counts 1 unique for each field (which is not accurate). How can I do this? Is there a completely different way? Thanks.


numFields=aFields(aColumns)
set safety off
set stat on

For i=1 To numFields
index on Upper(aColumns(i,1)) to temp uniq
? Upper(aColumns(i,1))
? 'Unique records:'
count
? ''
set index to
Next
 

Jim,

I ran your example in VFP6,
got "2 records indexed" as a message, and 3 as a result of ?_TALLY.

When UNIQUE is removed from INDEX, got both 3: "3 records indexed" as a message, and 3 as a result of
?_TALLY.



 
Stella, when I try VFP7 I get the same results as you. VFP5 is different! -Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top