The third parameter of DISTINCT VALUES really saves work.  Here is a strategy 
to find dups in a field within a selection.  The set can be a listbox highlight 
set.

  // ----------------------------------------------------
  // Method: DuplicatesToSet
  // - 
  // INPUT1: Pointer - field
  // INPUT2: Text - Set Name
  // OUTPUT: 
  // ----------------------------------------------------
$field:=$1
$set:=$2
ARRAY TEXT($aVals;0)
ARRAY LONGINT($aCount;0)

DISTINCT VALUES($field->;$aVals;$aCount)
SORT ARRAY($aCount;$aVals;<)
$pos:=Find in array($aCount;1)

If ($pos#-1)
        ARRAY TEXT($aVals;$pos-1)
End if 

SET QUERY DESTINATION(Into set;$set)
QUERY SELECTION WITH ARRAY(;$field->;$aVals)
SET QUERY DESTINATION(Into current selection)


Keith - CDI

> On Oct 31, 2017, at 3:40 PM, David Witton via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I'm looking for a strategy to identify duplicate records in a table - that
> is, records for which 3 fields are identical across two or more records -
> or in another case, where a single field is not unique.
> 
> Does anyone have a suggestion on how to proceed?
> 
> -- 
> David Witton 
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to