Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

duplicate a record along with its portal records..

Featured Replies

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 :-(

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.

  • Author

i see~ thank you

  • Author

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

  • Author

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)

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.

  • Author

i see~~ thanks~ :-D

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

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.