dbTalk Databases Forums  

Re: Duplicating set of records

comp.databases.filemaker comp.databases.filemaker


Discuss Re: Duplicating set of records in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Glenn Schwandt
 
Posts: n/a

Default Re: Duplicating set of records - 08-07-2003 , 02:45 PM






Two hints...

1. Sort your records before running your script.

or

2. Export then import.


"Robert" <zend999 (AT) yahoo (DOT) com> wrote

Quote:
Hi, I'm trying to duplicate a set of found records, while also
changing a field entry in the dup process. So say I started with 20
found records. I'd like to run the script and end up with 40 records.
20 untouched old records and 20 new records with the new field entry.
Here's the script I tried:

Loop
Duplicate Record/Request
Set Field["Info" , "New Info"]
Go to Record/Request/Page [Exit after Last, Next]
End Loop

All this accomplishes is duplicating the first record and then
stopping. I know why it does this, since the new duplicate record is
now the LAST record, and so the script exits (Exit after Last). But I
can't figure out a way around this. There must be an easy way to do
this that I'm missing. Any hints? Thank you!

(For the record, "New Info" is a global numerical field assigned by a
previous script, and the "Info" field is a key field relevant to
another database.)



Reply With Quote
  #2  
Old   
LaRetta
 
Posts: n/a

Default Re: Duplicating set of records - 08-07-2003 , 03:20 PM







Hi Robert,

Try this script - back up first as always:

Perform your find then …
Go To Record/Request [First]
Loop
Duplicate Record
Set Field [whatever you want to set the new field to be)
Omit Record
Go To Record/Request [First]
Omit Record
Exit Loop If [ not Status(CurrentFoundCount) ]
End Loop

This will create a new record and set your new record's field to your
new value. Keep in mind that Duplicate Record can be dangerous as it
also duplicates any ID key fields. You might want to use New Record
instead and then just include a Set Field script-step to set each new
field to the old record's value.

If you use New Record instead of Duplicate Record you will need global
fields to hold the data in which to transfer (make the globals the same
data type as each field), something like:

Perform your find then …
Go To Record/Request [First]
Loop
Set Field (each global field) to each existing records’ fields
Omit Record
New Record/Request
Set Field … each new record field with the global fields
Omit Record
Go To Record/Request [First]
Exit Loop If [ not Status(CurrentFoundCount) ]
End Loop

LaRetta

--
Posted via http://dbforums.com

Reply With Quote
  #3  
Old   
Shadenfroh
 
Posts: n/a

Default Re: Duplicating set of records - 08-09-2003 , 10:05 AM



Start on the last record, and work backwards.

Goto Record [Last]
Loop
Duplicate Record
Set Field(s)
Omit
Omit
Exit Loop If [ Status (CurrentFoundCount) = 0]
End Loop

A drawback could be that the duplicate records would be created in the
reverse order of the originals. If that's an issue, reverse sort your
originals before running the duplicate routine.

--
Shadenfroh
shadenfroh@yahoo

"Robert" <zend999 (AT) yahoo (DOT) com> wrote

Quote:
Hi, I'm trying to duplicate a set of found records, while also
changing a field entry in the dup process. So say I started with 20
found records. I'd like to run the script and end up with 40 records.
20 untouched old records and 20 new records with the new field entry.
Here's the script I tried:

Loop
Duplicate Record/Request
Set Field["Info" , "New Info"]
Go to Record/Request/Page [Exit after Last, Next]
End Loop

All this accomplishes is duplicating the first record and then
stopping. I know why it does this, since the new duplicate record is
now the LAST record, and so the script exits (Exit after Last). But I
can't figure out a way around this. There must be an easy way to do
this that I'm missing. Any hints? Thank you!

(For the record, "New Info" is a global numerical field assigned by a
previous script, and the "Info" field is a key field relevant to
another database.)




Reply With Quote
  #4  
Old   
Robert
 
Posts: n/a

Default Re: Duplicating set of records - 08-13-2003 , 06:11 PM



Thank you for the responses. Omit... that's the key. Thanks so much!

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.