'Original script: M.R. Binkley mr_binkley@yahoo.com 03/05/99 'Modified: GIS-Lab.info theTable = av.getActiveDoc theVtab = av.getActiveDoc.getVtab theField = thetable.GetActiveField theValueField = theVTab.FindField("Duplicate") theFieldName = theField.Getname mylist = list.make theFldPrec = theField.getprecision av.showmsg("Searching the field "+theFieldName.AsString.quote+"...") theSelCount = thevtab.GetSelection.Count recCount = 1 If (theSelCount >1) then For each rec in theVtab.GetSelection theValue = theVtab.ReturnValue(theField,rec) If (theField.istypenumber) then theValue.setformatprecision(theFldPrec) end myList.Add(theValue) progress = (recCount/theselCount) * 100 av.SetStatus( progress ) recCount = recCount + 1 End Else For each rec in theVtab theValue = theVtab.ReturnValue(theField,rec) If (theField.istypenumber) then theValue.setformatprecision(theFldPrec) end myList.Add(theValue) progress = (recCount/theVtab.GetNumRecords) * 100 doMore = av.SetStatus( progress ) if (not doMore) then break end recCount = recCount + 1 End End av.clearstatus theCount = 0 theduplicatelist = List.make av.Showstopbutton av.showmsg("Identifying duplicate values in "+theFieldName.AsString.quote+"...") for each elem in mylist thenewlist = mylist.clone theNewList.Remove(theCount) theListNumber = theNewList.FindByValue (elem) if (theListNumber <> -1) Then theObj = elem.AsString theduplicatelist.add(theObj) end progress = (theCount/myList.Count) * 100 doMore = av.SetStatus( progress ) if (not doMore) then msgbox.Warning("Partial search results will be displayed","Duplicate Value search interupted") break end theCount = theCount + 1 end theduplicatelist.removeduplicates theduplicatelist.sort(true) av.Clearstatus av.clearmsg If (theDuplicateList.Count < 1) then msgbox.Info("No duplicate values found.","Duplicate Values") return nil End theIndexFlag = false If (theVtab.IsFieldIndexed(theField).Not) then theIndexFlag = true thevtab.CreateIndex(theField) av.Clearmsg End queryCount = 1 theVtab.GetSelection.ClearAll theVtab.UpdateSelection theTempBitmap = theVtab.GetSelection theTempBitmap2 = theVtab.GetSelection If (theField.IsTypeString) Then For each fieldVal in theduplicatelist theQuery = "(["+theFieldName+"] = "+fieldVal.quote+")" bret = theVtab.Query(theQuery,thetempBitmap2,#VTAB_SELTYPE_new) if (thetempBitmap2.count > 0) then bitOffset = theTempBitmap2.GetNextSet(0) theTempBitmap2.clear(bitOffset) end for each rec in theTempBitmap2 theVTab.SetValue (theValueField, rec, "yes") end progress = (queryCount/theDuplicateList.Count) * 100 av.SetStatus( progress ) queryCount = queryCount + 1 End Else For each fieldVal in theduplicatelist theQuery = "(["+theFieldName+"] = "+fieldVal+")" theVtab.Query(theQuery,thetempBitmap2,#VTAB_SELTYPE_and) thetempbitmap2 = theTempBitmap.clear(theTempBitmap.GetNextSet(0)) theTempBitmap = theTempBitmap.or(thetempBitmap2) progress = (queryCount/theDuplicateList.Count) * 100 av.SetStatus( progress ) queryCount = queryCount + 1 End theVtab.clearselection(theTempBitmap) End