Repeat loop in filemaker Pro 7 database

How can I get my script to loop through a large FM database of records and change the data in a particular field as in the script below? I cannot figure out the syntax for the repeat loop...
with timeout of "3000" seconds
tell application "FileMaker Pro"
go to database "CPA FM Log Copy"
show every record of database "CPA FM Log Copy"
set theCount to number of record of database "CPA FM Log Copy" as integer
repeat with i from record theCount of database "CPA FM Log Copy"
if field "ph" of record i of database "CPA FM Log Copy" is "NG" then
set data field "ph" of current record of database "CPA FM Log Copy" to "Nice Going"
else if field "ph" of record i of database "CPA FM Log Copy" is "EC" then
set data field "ph" of current record of database "CPA FM Log Copy" to "Everything Cool"
end if
end repeat
end tell
end timeout

Depending on the number of records in the database, this isn't the most efficient way of doing this.
You should use a 'whose' clause in your script to narrow the FileMaker results to the subset of records you want to change, then change them all at once. This is far more efficient than looping through thousands of records in AppleScript looking for the ones you want.
This should get you on the right track:
<pre class=command>tell application "Filemaker Pro"
go to database "CPA FM Log Copy"
set theResults to every record of database "CPA FM Log Copy" whose field "ph" is "NG"
set data field "ph" of every item of theResults to "Nice Going"
set theResults to every record of database "CPA FM Log Copy" whose field "ph" is "EC"
set data field "ph" of every item of theResults to "Everything Cool"
end tell</pre>
In this way you let Filemaker do the searching (which is what it's optimized for), and your script does the least work necessary.
BTW, just so you know why your original script fails, it's because you say:
<pre class=command>set data field "ph" of current record of database "CPA FM Log Copy" to "Nice Going"</pre>
Note that you're always setting the 'current record'. This means that even if there are 1000 records in the database, you only ever set the first field. If you wanted to maintain the repeat approach this would have to change to something like:
<pre class=command>set data field "ph" of record i of database "CPA FM Log Copy" to "Nice Going"</pre>
so now it uses the loop iterator to track which record to change. An even better model that does use a scalar index is to do something like:
<pre class=command>repeat with curRecord in every record of database "CPA FM Log Copy"
if field "ph" of curRecord is "NG" then
set data field "ph" of curRecord to "Nice Going"
end if
end repeat</pre>
This nice thing about this model is that it uses FileMaker's internal references for records so that you know you're changing the right thing. This can be crucial if working in a multi-user database where there might be someone else is editing the data in parallel, changing theCount.

Similar Messages

  • FileMaker Pro and Database Connectivity

    Has anyone successfully accessed a FileMaker Pro DB file using the DB Connectivity Toolset?  If so what ODBC setup  et al was used?  I currently have an application that uses an MS Access DB file and am considering migrating to using FileMaker Pro DB instead.

    Duplicate.
    Try to take over the world!

  • Mail is in a loop.  I tried to send a bulk mailing from Filemaker Pro 10 and it has my mail program in a loop.

    I attempted to send a bulk mailing from my Filemaker Pro 10 database.  There were two bad addresses in the mix and mail continues to paint the attempts on my screen.  I have force quit the program but when I open it again, it goes back into the loop and paints messages until the program crashes.  How can I stop the emailing?

    Start off by trying to reset the ipad. Press and hold the power and home buttons at the same time until the device powers down and you see the Apple logo.

  • Link to Filemaker pro database from wiki fails

    Has anyone tried to create a link from within a wiki page that can launch a filemaker pro 9 database residing on the Xserve? I'm able to create the link in the edit page but when I click to save, the underlining disappears and the link is no more. I'm able to link to web-sites on the WWW and within other wiki pages but not to the fmnet:/XXX.XX.XXX.XX/HOME prompt. Thanks

    As I read this, you want to go from a web server using http protocol to a database server using its own protocol. You could use a redirect to take a link like http://domain.com/groups/fmpro to fmnet://xxx.xxx.xxx.xxx/HOME assuming the fmnet link is the link provided in the Menu/Send Link action of FM Pro.
    You can also read another approach here:
    http://discussions.apple.com/thread.jspa?messageID=8391240&#8391240
    HTH,
    Harry

  • Can I upload a simple iPhone App that all it does is direct the User to a Filemaker Pro URL   fmp://~filename.fmp?$VariableName=Value  This launches Filemaker Go and directs the user to the Database Hosted online   Right now there is no app store for

    Can I upload a simple iPhone App that all it does is direct the User to a Filemaker Pro URL   fmp://~filename.fmp?$VariableName=Value  This launches Filemaker Go and directs the user to the Database Hosted online
    Right now there is no app store for Filemaker Go.   Filemaker Forgot about us.
    So I want to create a simple native iPhone App that all it does
    is launch
    fmp://~/filename.fmp12?$VariableName=value
    This URL will launch the Filemaker Go App
    Filemaker Go is a app that the user will have to have
    downloaded already on the device..
    The Simple Native app will launch the Filemaker Go.
    The fmp  URL has the information where the Filemaker Pro database is hosted
    and get  the user where they need to be..
    Help Me please
    iPhone 5s, iOS 8.1.3

    That would be software. And, you said "upload." That's "uploading software." Why do you question what you stated?
    I don't know where you even want to upload this software. The only way it can be downloaded to a device is through the iTunes store. Do you even know what you want to do?

  • Is there a cheap or free good alternative program to Filemaker pro that will work on Mavericks and allow me to open FM databases from version 7?

    I recently switched from a power pc (2004 I think) to a MacBook Pro, and had to upgrade so much. My old system was running Filemaker pro 7. I really need a good database program for my work (freelance/self-employed), and have forked out so much money on other programs, that I'm hoping I can find a freeware or shareware version of a good DB program to use that will work for me. Any suggestions? I am not that tech-savvy. Thanks.

    Ditto on all those points.  I recommend Carbon Copy Cloner to make a full bootable backup.  Time Machine is NOT adequate, particularly for virtual machines.
    After upgrading to Yosemite, make sure you do a repair permissions in disk utility....and be prepared for some 10.10 bugs (it's just now becoming stable).

  • Can I run a filemaker pro database in iCloud

    can I run a filemaker database in icloud

    Though its true you can host a Filemaker Pro database on iCloud, I did something which might be interesting or valuable to you.
    I made a database with all file containers stored outside the database.  The result is a lightweight database that links all images/pdf/etc to a path in the same context as the database is stored. 
    I used then Dropbox and I can access the database from multiple machines, though not edit/add information at the same time.  Its even posible to open the database on your iOS device and see changes, etc, with the last stored database on Dropbox.
    I know this wont work for anybody, but it did for my girlfriend who stores data at work, and later review it at home.

  • Indexing Filemaker Pro database with Spotlight?

    ...am I missing something or why can't Spotlight find ANY entries in my Filemaker Pro databases? I have set no exclusion for indexing.
    All my Music, Movies, collections etc are catalogued in Filemaker but Spotlight can't find it. It lists everything else, iTunes songs,email attachments, words in documents and records and numbers in spreadsheets.
    Thanks

    I just stumbled upon a mdimporter for OpenOffice but I had to look inside the package.
    app-package / contents / Library/Spotlight
    OOoSpotlightImporter.mdimporter
    I double-clicked and first time in 8 yrs using OS X, asked if I wanted to add to Spotlight Plug-in, so I said "yes."
    Does an app (OpenOffice in this case) add its mdimporter to Spotlight the first time it launches? No.
    There was none in /Library/Spotlight and I've never known about this, or the need to find and add to Spotlight. And this was only the 2nd application I've added that includes an importer (URL Manager is old but had one).
    +(I would love to exclude url and bookmark(s unchecked) it still finds bookmark - Safari reads the bookmark.plist and writes them into ~/Library/Caches/Metadata/Safari/+
    More custom prefs and features in the control panel.
    Search inside the folder I am in, which seems obvious.
    Ability to add a folder to the search index, or to update.
    I would like Spotlight if it was half as good as Vista's (also has a much more robust open/save but those aren't enough reasons to use Vista.
    Don't start indexing a drive that I just formatted and backing up to (ask first, and wait until I/O and system is "quiet").
    Searching for tech notes on or a www.apple.com/support/spotlight or /leopard/spotlight didn't bring up anything but "features" but nothing useful.
    Do I need a developer's manual to get more from Spotlight?
    Path Finder search/find but it has a problem with preventing quitting and with shutdown/restart so I can't leave it in the background. It searches 'everywhere' so it can't just depend on Spotlight's indexes.... can it?
    http://www.cocoatech.com/pf4/

  • Unable to get Database Connectivity vi to List Tables of a Filemaker Pro database

    Hello Forum,
    I've been successful using my ODBC Admin to create a System DSN for a simple Filemaker Pro db on my PC running Windows XP (I wish I could delete my previous post asking for help doing that!).  Now, my LV program successfully "connects" to the db using the "DB Tools Open Connection vi".  However, I cannot get the "DB Tools List Tables" vi to give me a list of the database's tables.  LV just returns an empty string array.  However, I can accomplish other tasks such as listing the columns of a table using the "DB Tools List Columns" vi.
     Any thoughts on why I cannot list the db's tables??

    Hi NI,
    I am still getting a empty string array result when I use "DB Tools List Tables" vi.  I am running Filemaker Pro 10.0v1 and LabVIEW 8.2.  I can get other DB VIs to work just fine, namely: "DB Tools List Columns", "DB Tools Insert Data", "DB Tools Execute Query" and "DB Tools Fetch Recordset Data".  I can obviously work around not having the "List Tables" code, but it makes me wonder where I'm going wrong.
    Andy 

  • Migrating Filemaker Pro Databases

    Hi there,
    I was wondering if Migration Workbench has any functionality
    that would allow me to easily convert Filemaker Pro databases
    over to Oracle8i?
    Dave
    null

    David Williams (guest) wrote:
    : Hi there,
    : I was wondering if Migration Workbench has any
    functionality
    : that would allow me to easily convert Filemaker Pro databases
    : over to Oracle8i?
    : Dave
    FYI..
    A month ago, I called the tech support & the individual informed
    me that the only choice that I have is SQL Loader due to the
    Migration Workbench does not support the Filemaker Pro.
    null

  • After I upgraded to Firefox 5 for Mac, I have problems logging into our FileMaker Pro database.

    After I upgraded to Firefox 5 for Mac, I have problems logging into our FileMaker Pro database. When I type in my Account Name and Password and click Login, Firefox just refreshes back to the blank login window.

    Hi All,
    Any help?
    No one has any answers here amoungst all this apple knowledge?
    Thank you

  • Applescript works fine in ScriptEditor but not in Filemaker Pro

    I'm getting an odd result from an Applescript script being called from within Filemaker that I've not seen before nor have I found a reference to it online here or elsewhere.
    The following script creates three new records and makes a call to the Filemaker script "paste_into_container". The FM script "paste_into_container is very simple, it pastes whatever is currently on the clipboard into a specific container field. When the script is called from within Filemaker, the "paste_into"container" subscript will only paste the contents of the clipboard into the last new record. The container field on the first two records is left blank.
    It's almost as if the loop creates the new record, ignores the "go to last record and "paste_into_container" lines in the script, and then moves on to the next iteration of the loop.
    The script works fine when called from ScriptEditor but fails when called from within Filemaker. The script will also work if I drop the repeat loop and create just one record.
    I've tried increasing the delay added at the end of each loop but it does not make any difference whether it is 1 or 15 seconds.
    I'm sure it's something simple but I'm not seeing it and after two days it's time for help (of one kind or another)
    additional info:
    Mac OS 10.6.8
    Filmaker Pro 11 running with Filemaker Server 11
    Thanks in advance
    Phil
    tell application "FileMaker Pro"     show every record in table "Image_Info" in database myDB     go to layout 1 of database myDB
        repeat with i from 1 to 3         set myNewRecord to create new record in database myDB        go to last record        do script "paste_into_container"        delay 1    end repeatend tell

    Hi TW
    Good suggestion. I tried it but no result.
    Here's what's odd. I created two fields in the FM database, one called ScriptCall and the other ScriptResult. I then modified the applescript as follows:
    tell application "FileMaker Pro"
        show every record in table "Image_Info" in database myDB
        go to layout 1 of database myDB
        repeat with i from 1 to 3
            set myNewRecord to create new record in database myDB
            go to last record
         set cell "ScriptCall" in myNewRecord to "1"
            considering application responses
                do script "paste_into_container"
            end considering
          set cell "ScriptResult" in myNewRecord to "1"
            delay 1
        end repeat
    end tell
    I set this up to test where the problem might be. The results were odd. The applescript creates three new records.
    Record 1
    ScriptCall = 0
    ScriptResult = 0
    Record 2
    ScriptCall = 0
    ScriptResult = 0
    Record 3
    ScriptCall = 1
    ScriptResult = 1

  • I want to be able to view data created with filemaker pro on my muse site

    I have created a muse site and would like to include a page that has five drop down menus on it that pull from a (preferably filemaker pro) database. The idea being, that each dropdown determines where the next set of data is pulled from in the database.
    I have spent some time looking around and seen a lot of information about business catalyst etc but have not seen a clear and definitive answer.
    Can anybody point me in the right direction?
    Many thanks in advance!

    Thank you Anshul, much appreciated. I will look into trying this! Ill get back to you. Thanks for the link too. Ill take the following(see below) from it and try that out too!
    "Late to the party but I've worked with filemaker pro in the past and the BC API extensively.
    Filemaker pro is well filemaker pro, it's meant for little commercial ventures or organizing your CD collections, anything business with over 20,000 records I would use or get something else (like BC). Even MS acesss is better, although harder to use, filemaker is also prone to database corruption so you need to backup.
    For automation, filemaker pro has ODBC connect-ability so you can directly access the data stored within it, piping data in or out or to the BC API if you wanted. Since filemaker pro is a self contained local app (and if I were building something) I would build a little local tool app you could launch and import / export the data for you based on your business rules or what you were trying to automate, this could be automated if you wanted to do something like that.
    If you or anyone is interested, it's relatively straight forward working with ODBC since it's base is SQL to get to the data. Just need the business logic on what you want to achieve."

  • FileMaker Pro icons not displaying correctly

    After updating to Yosemite, all of my FileMaker Pro document icons are displayed as generic icons (juts the outline of a piece of paper). This occurs both in Finder and on the Dock.
    Other document icons seem okay. If I do a Get Info on a document, the icon seems okay in the Get Info window.
    Does anyone know how to correct this behavior?
    Thanks!

    Thanks, coreworksnet.
    I was also seeing this problem with FM 13. I was able to get around it, but it was a headache. I had to go into each individual DB file and do a Get Info. That dialog shows the icon for the document (which, strangely enough, showed the correct icon). I then copied the icon over from the FM app (which visually did nothing). But once I closed the Get Info dialog, the icon for the DB file was correct.
    Repeat a few dozen times for all of my DB files, and it seems okay now.

  • What ODBC driver to use in order access Filemaker Pro from Excel

    Hi
    I run Filemaker Pro 11 and Excel on my Mac OSX 10.5.
    I want to access my Filemaker database directly from Excel (to use the data in Pivot tables without first having to export the data from Filemaker). What ODBC driver should I use?

    Bruce, I have an indexed, 5 Billion record MS-Access Jet (Red) 4.x format database file system (no table linking), 1 table only, each MDB file acting as a partial table, not a database. This database contains 500 x 2-GIG files, each file with 10
    million rows - text compression/encryption turned on.  I created this 1 Terabyte file system (empty) using ODBC Administrator which came installed on my Windows 7 Home Premium Laptop (Factory installed, no Service Packs).  I used ODBC/SQL then
    to create the tables/indexes within the empty MDB files.   I have a MEMO data type in my table too with text as long as 528 characters.    I have used MIMEbase64 encoding too, so that the data is not humanly readable neither via SQL
    nor by opening an MDB file in WordPad.   I do the decoding during SQL processing.
    In my FILE DSN, I bumped Threads property to 510 from default 3, so that I could run 510 simultaneous/concurrent SQL processes on my Laptop, to produce reliable report output. 
    You might consider this little setup, if nothing else works, as long as the PCs have either Windows XP or 7 installed.   MS-Access ODBC driver is already installed for Jt 4.x format, and you can compact/repair the 4.x files using ODBC Administrator,
    or get the GUI/commandline utility JetComp.exe to do it, which is freely distributable.
    I know this is not likely your answer, but it is a good fall back perhaps for someone.

Maybe you are looking for