Normal Topic Remove Duplicate Records From Results (Read 481 times)
dcostanzo
Junior Member
Members
**
Offline


No personal text

Posts: 58
Joined: Mar 13th, 2003
Remove Duplicate Records From Results
Apr 18th, 2006 at 1:17am
Print Post Print Post  
Hello!

I am working in *.db where I have the following elements:

Ticket Number
Manifest Number
Trucker

In my business, the ticket number element must be a unique. (key)

I had a situation arise where I had two records with the same ticket and manifest number but different trucker values.

After running a retreive on all records, under Result Commands: Remove Duplicates From Results.  Sesame did not find any duplicate records.

As specified on page 172 Users Guide. Sesame did not find any case-blind matches for all fields in the database.

As stated on Page 173 Users Guide: Q&A had a different delete duplicate procedure where you must specify which fields should be matched to determine a "duplicate'.

What I needed Sesame to do is find a duplicate for a specific element.- ticket number.  In this case, it would have retreived two records with same ticket number.

Has anyone ran into this situation or offer any tips? ???

Is there a "Restriction" that needs to be in place for this element -Ticket number for a unique field?

or could there be a spec window in the spec manager like (Sort, Import, Export, Copy) that can be for selecting elements in which to check for duplicates on specific elements? Not the entire form.

Regards,

David Costanzo
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Remove Duplicate Records From Results
Reply #1 - Apr 18th, 2006 at 4:38am
Print Post Print Post  
Please try the following. 

Code
Select All
var n as Int

		n = @ResultSetCurrentPosition ( )

		If @FormFieldValue ("Vital", "RecNumber", n) = @FormFieldValue ("Vital", "RecNumber", (n + 1)) then
			{
				Name = Name + " To be Deleted"
			}

/*
This code is used to remove duplicate records based on selected duplicate elements similar to option available in removal of duplicate records in Q&A. This code will first flag the records to be deleted in one of the text fields.

Get the record set of all the records. You may add other duplicate elements in the condition part of if statements to choose multiple duplicate elements.


Sort all Duplicate elements in Ascending order (for whatever you would put "D" in Q&A Removal spec
last sort the Counter field in ascending order.

The above sort will assure that the latest record will be preserved.

Mass Update using above code
Delete or export and delete all the flagged records.

If you ever have to undo the process just remove the flag using
Name = @Replace (Name, "To be Deleted", "")
*/

 



In the above example it looks for duplicates RecNumber element and place a flag in the Name element in Vital form of Vital.db application. This is from my old notes and I have not tried it lately but it should work.  Please let us know if it works for you.  I am sure somebody will come with something easier than this.

Bharat Naik
  
Back to top
 
IP Logged