Skip 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.

Duplicating Records - Automatically

Featured Replies

Hi Everyone. I am on the verge of being an Intermediate FileMaker user but am having a problem on one simple script:

I have a client database listing all of my clients. Sometimes I need to duplicate a client record depending on certain aspects of their account.

Is there any way to duplicate a record using the ScriptMaker? For instance, if I had field called "copy" and, entered a value of 4, is it possible to duplicate that record four times at the touch of a button. Also, say I have 5 records that each need to be duplicated a different number of times. How can/would I accomplish this?

Thanks very much for your help. Any guidance is much appreciated.

For a single record.

Set Field [globalcopy, copy]

Set Field [copy, ""]

Loop

Duplicate Record/Request

Set Field [globalcopy, globalcopy - 1]

Exit Loop If [not globalcopy]

End Loop

For multiple records, it will be trickier, because where a duplicate appears in your record set depends on how the set it sorted. If the records are unsorted, then duplicates will appear at the bottom of the set. So once the loop duplicates the first record X times, you have to go to the second record in the set, run the loop, then go to the third record, etc. To make this easier, you can keep ommitting the first record. If the records to be duplicated are the only found records, then you can set a global with Status(CurrentFoundCount) and then decrement it after each major loop, stopping when it reaches zero.

Set Field [globalcount, Status(CurrentFoundCount)]

Unsort Records

Go to Record/Request/Page [First]

Loop

Set Field [globalcopy, copy]

Set Field [copy, ""]

Loop

Duplicate Record/Request

Set Field [globalcopy, globalcopy - 1]

Exit Loop If [not globalcopy]

End Loop

Go to Record/Request/Page [First]

Omit Record

Set Field [globalcount, globalcount - 1]

Exit Loop If [not globalcount]

End Loop

The resulting found set should be only the duplicated records.

  • Author

Forgive me for asking such a silly question but I am unable to get

Set Field [globalcopy, copy] when I select the Set Field option in Scriptmaker. I am able to specify only the one field - copy. Does this script require two fields - both a globalcopy field and a copy field?

Thanks again for your help

globalcopy is the field to specify as the target field. copy is the calculation to specify.

globalcopy should be a global number field. You can either create a new global or use an existing one that isn't being used elsewhere in the script.

As macusers do we have yet another option when the request is to make X dupes:

Perform AppleScript [ Calculated AppleScript: "repeat " & GetAsText ( Int(Ln ( test::gDupeRequest ) /Ln ( 2 ))) & " times

  • Author

I have it working beautifully!

Thanks for both of your help. It is much appreciated.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.