Dear Listeners,
On 6 Nov. 2008 I had asked the group whether somebody knew a solution to
check records which contain a field with a long string (160 or even 260
bytes) for duplicate entries. I need(ed) to find even the slightest
difference amongst bank account records downloaded from a telebanking site.
There were several contributions (MD5, Plugins) - thanks for that input so
far.
A few days ago I started tinkering on that issue again and found another way
to tackle it - it turned out to be surprisingly simple!
Using plain FMP 6 I did the following:
--
Create 2 global fields, type text:
g.comparison.1
g.comparison.2
--
Create a text field:
t.duplicate.marker
--
Create a calc field:
c.compare.comparison.1.with.comparison.2
with the following formula:
Case(
Left(g.comparison.1;20)
=
Left(g. comparison.2;20)
and
Middle(g. comparison.1;21;20)
=
Middle(g. comparison.2;21;20)
and
[and so forth...]
Middle(g. comparison.1;241;20)
=
Middle(g. comparison.2;241;20)
;
"Duplicate!";
""
)
--
Create a script:
Sort [Restore, No dialog]
Replace Contents [No dialog, "t.duplicate.marker", """"]
Go to Record/Request/Page [First]
Loop
Exit Loop If ["Status(CurrentRecordNumber)=Status(CurrentFoundCount) "]
Set Field ["g.comparison.1", "Substitute(--here a text concatenation of all
fields to be compared--;" ";"")"]
#Comment: Substitute is used to shorten the string as much as possible.
Go to Record/Request/Page [Next]
Set Field ["g.comparison.2", "Substitute(--here a text concatenation of all
fields to be compared--;" ";"")"]
If ["c.compare.comparison.1.with.comparison.2="Duplicate!""]
Set Field ["t.duplicate.marker", ""Attention! Duplicate!""]
End If
End Loop
--
Even with a field length of 260 (normally the maximum in FMP 6 would be 60)
the comparison works flawlessly and quite fast - approx. 900 records/second
on a 2.4 GHz Win XP machine.
--
Met vriendelijke groet / Mit freundlichen Gruessen / With kind regards
Christoph Bouthillier
p o s t <<a t>> oh-no-spam t e k s t o t a a l << d o t >> c o m
Forget the oh-no-spam
>> Stay informed about: CRC calculation per record possible? (Continued from threa..