Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scanning for repeated records in a table
Message
From
05/03/2007 09:42:46
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01200695
Message ID:
01200709
Views:
19
This message has been marked as a message which has helped to the initial question of the thread.
>How would you use scan command to look for repeated records in a table ?

If you take care of array limit you can do something like:
FUNCTION FindDupes(tcAlias)
CREATE CURSOR DupRecs (rec1 i, rec2 i)

SELECT (m.tcAlias)
DIMENSION oRecords[RECCOUNT()]
SCAN
  SCATTER NAME oRecords[RECNO()] memo
ENDSCAN

SCAN
  SCATTER NAME oCurrent memo
  FOR ix = RECNO() + 1 TO ALEN(oRecords)
    IF COMPOBJ( oCurrent, oRecords[m.ix] )
      INSERT INTO DupRecs (rec1,rec2) VALUES (RECNO(m.tcAlias),m.ix)
      INSERT INTO DupRecs (rec1,rec2) VALUES (m.ix,RECNO(m.tcAlias))
    endif
  ENDFOR
ENDSCAN
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform