Enter a single record in blank form from form with duplicate

Moderators: Phil Winkler, Graham Smith, Pete Tabord

Enter a single record in blank form from form with duplicate

Postby RonCarver » Tue Jul 20, 2010 2:16 pm

Does any one hast script to just enter a single record into a new duplicate form from a form that contains duplicates?
In other words Form1 has many john smiths and jack daniels
I want to select only one instance of john smith and jack daniel in form 2.
Please advise. Thanks
RonCarver
 
Posts: 7
Joined: Sat Feb 27, 2010 1:02 pm
Has thanked: 0 time
Been thanked: 0 time
 

Re: Enter a single record in blank form from form with duplicate

Postby Adrian Jones » Tue Jul 20, 2010 3:01 pm

Is this a one-off or a regular requirement?

If a one-off:

1. Save the form with dups under another name, making sure it defines a new form. Don't copy data.
2. Add a unique field derived from concatenating your names. Remove any existing unique fields (temporarily).
3. Create a proc along the lines of:

for LoadsOfDups ;
enter a record in NoDups
copy all from LoadsOfDups .
end

The unique field will filter out the dups for you. Just ignore the error msgs.
User avatar
Adrian Jones
 
Posts: 2000
Joined: Tue Sep 11, 2007 2:38 pm
Location: Cornwall, UK
Has thanked: 5 times
Been thanked: 4 times
 

Re: Enter a single record in blank form from form with duplicate

Postby RonCarver » Wed Jul 21, 2010 2:06 am

Thanks for the respone.
That is what I was doing, but I did not like the errors. (not very appealing).
What I have done is to copy all records and then execute a procedure

define temp "repid" numeric string 6 .
for form2 ;
if mainid = temp repid then
delete records
end
assign tem temp repid := mainid .
end

It seems to work.
I was hoping for a cleaner record transfer as it is a weekly procedure for about 10,000+ records.
RonCarver
 
Posts: 7
Joined: Sat Feb 27, 2010 1:02 pm
Has thanked: 0 time
Been thanked: 0 time
 

Re: Enter a single record in blank form from form with duplicate

Postby Adrian Jones » Wed Jul 21, 2010 4:58 am

Er, that's why I asked if this was a one-off...

The basic outline of a proc might be:

Code: Select all
define "tExistsYN" text 1 .

for SourceForm ;
  tExistsYN := "N" .
  for TargetForm named "AlreadyIn" with MatchField = SourceForm MatchField
    tExistsYN := "Y" .
    break . -- for Target
  end
  if tExistsYN = "N" then
    enter a record in TargetForm
      copy all from SourceForm .
  end -- if
end   -- for SourceForm

(Others may suggest similiar outlines with 'count of' and 'if any x field = blank', but they are all variations on the same thing: see if this record already exists, and post it if it doesn't.)

However, with the volume of data in your source and presumably something similiar and growing in the target, this routine will likely take a while. That may or may not be acceptable.

So I'd be tempted as well to try exporting the data and re-importing it using add or update, maybe even using an intermediate form to hold the data, if how you want to determine uniqueness for this exercise differs from that of the target.
User avatar
Adrian Jones
 
Posts: 2000
Joined: Tue Sep 11, 2007 2:38 pm
Location: Cornwall, UK
Has thanked: 5 times
Been thanked: 4 times
 

Re: Enter a single record in blank form from form with duplicate

Postby RonCarver » Thu Jul 22, 2010 10:13 am

Thanks, I will try and see which process takes less time.
RonCarver
 
Posts: 7
Joined: Sat Feb 27, 2010 1:02 pm
Has thanked: 0 time
Been thanked: 0 time
 
 

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron