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

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

Recommended Posts

Posted

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.

Posted

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.

Posted

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

Posted

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.

Posted

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

This topic is 7293 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.