dbTalk Databases Forums  

Duplicating mulitple records

comp.databases.filemaker comp.databases.filemaker


Discuss Duplicating mulitple records in the comp.databases.filemaker forum.



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

Default Duplicating mulitple records - 11-21-2005 , 04:37 PM






I have a Orders file that relates to a LineItems file via OrderID.
How can I duplicate all the LineItems from one Order and assign them a
new OrderID? FM7 in a cross platform solution.
Thanks,
G


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

Default Re: Duplicating mulitple records - 11-22-2005 , 01:15 AM






I answered my own question, and thought I'd share the solution. The
script goes something like this...("g" fields are globals)
Start with the record you want to dupe (ie with a portal)

Set gOrderID1 to OrderID
Duplicate record
Set gOrderID2 to OrderID
New Window
Go to LineItems
Enter Find
Set OrderID to gOrderID1
Perform Find
Loop
Duplicate Record
Set OrderID to gOrderID2
Omit Record
Go to Record First
Omit Record
Exit Loop if Get(FoundCount) = 0
End Loop
Close Window


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

Default Re: Duplicating mulitple records - 11-22-2005 , 01:47 AM



In article <1132643737.283023.30700 (AT) g47g2000cwa (DOT) googlegroups.com>,
grip (AT) cybermesa (DOT) com says...
Quote:
I answered my own question, and thought I'd share the solution. The
script goes something like this...("g" fields are globals)
Start with the record you want to dupe (ie with a portal)

Set gOrderID1 to OrderID
Duplicate record
Set gOrderID2 to OrderID
New Window
Go to LineItems
Enter Find
Set OrderID to gOrderID1
Perform Find
Loop
Duplicate Record
Set OrderID to gOrderID2
Omit Record
Go to Record First
Omit Record
Exit Loop if Get(FoundCount) = 0
End Loop
Close Window


Looks good. There's a variety of ways you could have iterated through
the records to duplicate them, but there's nothing wrong with your
approach.

You'll also want to add some error checking... and make sure your loop
has a found set to work on after the find.

Other than that... Just be sure to comment it...

-cheers,
Dave





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

Default Re: Duplicating mulitple records - 11-28-2005 , 12:54 PM



Thanks. How do I comment a script? What should I include in the
comments?


For the found set I can just slip in a

If(Get(FoundCount) = 0
Close Window
Show Custom "No LineItems to copy"
Exit Script
End If


Reply With Quote
  #5  
Old   
42
 
Posts: n/a

Default Re: Duplicating mulitple records - 11-28-2005 , 06:29 PM



In article <1133204052.792190.207690 (AT) g49g2000cwa (DOT) googlegroups.com>,
grip (AT) cybermesa (DOT) com says...
Quote:
Thanks. How do I comment a script?
Add a "comment" script step. It does nothing but hold the text you put
into it.

Quote:
What should I include in the
comments?
Think about what someone else trying to figure out what the script does
5 years from now would want to know. Include that.



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.