Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7396 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

hi all... does anyone know how to duplicate a record along with all its portal records (related, of course). i tried the Duplicate record, but it only duplicates the parent record, and then i tried the Copy all script step to try to copy everything from portal and paste to the new portal... and nothing gets pasted :-(

Posted

It's more complicated than that.

You need to create the new master record (so you know it's key field value) then go to the original's related records, duplicate them one by one and set each duplicate related record to have the key value of the new duplicated master record.

A fancy bit of scripting will do it.

Posted

argg.... there is this problem when i am trying to script... and it's a really strange problem!

when i loop to go to each portal row and duplicate it, sometimes it places the duplicated row 2 or 3 rows away from the original row. this causes the loop to go to infinite... i can't find out why the program does that... sometimes it places the row right beneath the current record, sometimes 2 or 3 rows away... and the active row is set to the newly duplicated row.

i checked the sort records, but the problem doesnt seem to be there

Posted

ok... i ended up making a new field "Dup" to indicated if a record has been duplicated or not to solve the problem.. but is there other ways of doing it, or is FileMaker supposed to do something like that? (i.e. jumping rows)

Posted

No no no, don't try to do this in the master table! Looping through portals is neither robust nor reliable, as you are discovering.

Use the Go to Related Record (show, relationship) script step to "find" the related records, then do the looping in the related table itself. Return to the master record when completed.

There is a trick to remember: a new record in an unsorted database goes to the end (will be last). In a sorted database, the new record goes immediately after the current record. Use this behaviour to make your task easier...

Sort [restore, no dialog]

Loop

Duplicate Record/Request

Set Field [remotekey, dupmasterID]

Go to Record/Request [next, exit after last]

End Loop

As long as the records are sorted this will work. It does not matter which field the sort is done by.

Posted

Well, you could always get a Mac.

Assuming a relationship that allows creation of related records; and a layout that display data fields only, no calc fields:

Perform applescript:

Copy every cell of current record to dataList

create new record with data dataList

This topic is 7396 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.