cbntor Posted December 7, 2004 Posted December 7, 2004 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.
-Queue- Posted December 7, 2004 Posted December 7, 2004 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.
cbntor Posted December 7, 2004 Author Posted December 7, 2004 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
-Queue- Posted December 7, 2004 Posted December 7, 2004 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.
Søren Dyhr Posted December 8, 2004 Posted December 8, 2004 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
cbntor Posted December 8, 2004 Author Posted December 8, 2004 I have it working beautifully! Thanks for both of your help. It is much appreciated.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now