Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding Duplicate Records Across 21 tables
Message
From
02/11/1998 12:56:54
 
 
To
02/11/1998 11:02:59
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00153490
Message ID:
00153633
Views:
23
Tim ---

For this to work, you need to have an index on each table (tag-named DUPECHK here but called what you will) on STR(gross,12,2)+invoice...
PUBLIC mytabs(21)
USE table1 ORDER dupechk IN 0
mytabs(1)="table1"
USE table2 ORDER dupechk IN 0
mytabs(2)="table2"
...etcetera ... do this 21 times
SELE table1
COPY STRU TO duplicates
USE duplicates IN 0 EXCL
SELECT duplicates
INDEX ON STR(gross,12,2)+invoice TAG dupechk
FOR i = 1 TO 21
   cTable=mytabs(i)
   SELECT (cTable)
   SCAN
      cGross=STR(gross,12,2)
      cInvoice=invoice
      IF SEEK(cGross+cInvoice,"duplicates")
         LOOP
      ENDIF
      lIsNewDupe=.F.
      FOR j = 1 TO 21    
         IF j=i
            LOOP
         ENDIF
         cCheckTable=mytabs(j)
         lIsNewDupe=SEEK(cGross+cInvoice,cCheckTable) 
         IF lIsNewDupe
            EXIT
         ENDIF
      ENDFOR
      SELECT (cTable) 
      IF lIsNewDupe
         SCATTER MEMVAR
         SELECT duplicates
         APPEND BLANK
         GATHER MEMVAR
         SELECT (cTable)
      ENDIF
   ENDSCAN
ENDFOR

This should tighten things up in run time. Lemme know :-)
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Reply
Map
View

Click here to load this message in the networking platform