Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Slow FileMaker Scripting Code



Title: Slow FileMaker Scripting Code
The code I'm going to paste in below is excrutiatingly slow, about 3 seconds on my computer to create one record and then fill in about 40 fields.

Almost all the time is taken up setting the fields to the individual values.

I've observed that FileMaker fills in the fields individually, you can actually watch the fields populate in order on the screen (very slowly). This is a performance problem when multiplied by a thousand or two. It's barely quicker to set all the cells at once than it is to loop and set them individually (especially when not all the cells need to be set every time).

One alternative is to "create new record with data { <list of values> }". This is lightning fast but it also means that a layout has to be created with the fields to be populated in a specific order on the screen (because the list in this case is just data, no cell names need apply), which I'd rather avoid since it bothers me to have this dependency (and it makes the code harder to port to another database). But I suppose if I have to, I will.

If there are any speedier and more flexible alternatives, please let me know.

- David Crowe

-- Following code takes about 3 seconds
set StartTime to current date
tell application "FileMaker Pro Advanced"
 
       
tell database "Meeting Tracker" to tell window "Meeting Tracker" to tell layout "Contacts for AppleScript"
             
set DataFill to {"Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane"}
         
tell (create new record)
                       
set {cell "Address Book ID", cell "group", cell "first name", cell "middle name", cell "last name", cell "organization", cell "department", cell "suffix", cell "note", cell "birth date", cell "title", cell "job title", cell "nickname", cell "home page", cell "address work country", cell "address work street", cell "address work zip", cell "address work state", cell "address work city", cell "address home country", cell "address home street", cell "address home zip", cell "address home state", cell "address home city", cell "AIM handle", cell "Yahoo handle", cell "MSN handle", cell "ICQ handle", cell "Jabber handle", cell "phone bridge", cell "phone home", cell "phone home fax", cell "phone main", cell "phone mobile", cell "phone work", cell "phone work fax", cell "email work", cell "email home", cell "email other"} to DataFill
         
end tell
       
end tell
end tell
display dialog "Elapsed: " & (current date) - StartTime -- 3 seconds

-- Following code takes less than 1 second
set StartTime to current date
tell application "FileMaker Pro Advanced"
 
        tell database "Meeting Tracker" to tell window "Meeting Tracker" to tell layout "Contacts for AppleScript"
                create new record with data {"Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen", "Jane", "Austen"}
        end tell
end tell
display dialog "Elapsed: " & (current date) - StartTime -- 0 seconds
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.