Re: Creating FileMaker records using a Layout
Re: Creating FileMaker records using a Layout
- Subject: Re: Creating FileMaker records using a Layout
- From: Rob <email@hidden>
- Date: Wed, 02 Oct 2002 21:02:58 -0700
On 10/2/02 11:24 AM, "email@hidden"
<email@hidden> wrote:
>
Subject: Creating FileMaker records using a Layout
>
Date: Wed, 2 Oct 2002 19:22:08 +0200
>
>
Hi everyone,
>
>
I have one database with a wide collection of fields. Three of them cannot
>
be left empty when you create a new record. For this reason, I have one
>
layout called "minimal" which lists these three fields (and only these).
>
>
I have been using the follwing script with FileMaker for some time:
>
>
tell application "FileMaker Pro"
>
tell database db
>
create new record at end of layout "minimal" with data { 1, 2, 3 }
>
end tell
>
end tell
>
>
This code would make a new record and populate the three required fields
>
with value 1, 2 and 3.
>
This has been working without any problem for some time, and the script has
>
created a few thousand records.
>
After making some changes to the database (basically, adding some
>
calculation and summary fields), this script stopped working. Since then on,
>
I always get the "Set data failed, wrong data supplied" -10075 error code.
>
The definition of any of the fields involved in the Script did not change.
>
You can make a new record "by hand" with those values without any complaint
>
or warning from FileMaker.
>
>
I found some people on the net (http://www.concisedevelopment.com/;
>
http://home.knuut.de/paul/scripts/mailsmith/Export_to_FMPro3.html) using
>
this technique as well.
>
>
After some (quite a lot) of hours of struggle, I decided to change the field
>
definitions of the database (actually a copy of it) so that no value would
>
be required nor checked for validation. After that, I could see that the
>
script was actually creating a record, and populating it with data. However,
>
the fields being filled are not the ones present at layout "minimal", but
>
the three first fields in creation order (equivalent to layout 0). I have
>
tried to understand the FileMaker documentation and found out some
>
contradictions with regard to this (so, I ignored it).
>
>
I have tried the same code on other databases and found out that the
>
behaviour of FileMaker is (at least for me) unpredictable. Some times it
>
will take notice of the 'of layout "minimal"' part of the sentence,
>
sometimes will just fill the fields in creation order.
>
>
So, apparently the problem is related to FileMaker and not to AppleScript.
>
>
Has anyone experienced something like that?
>
Could you find out how to make AppleScript+FileMaker do what you really want
>
it to?
>
>
I am using FileMaker Pro 5.0Ev3 (E means Spanish), Mac OS E1-9.2.2,
>
AppleScript E1-1.7.
>
I have tried to download AppleScript 1.8.3 but it won't let me install on a
>
non-English Mac OS, and I could not find a Spanish version for it.
>
>
Thanx to all.
>
>
Joan Sanchez Sabe
Try the following AppleScript to see if you can use some of the statements.
Rob
-- first tell block loads some text from a file into a variable
-- ( you can ignore it and go on to the second tell block. Do not use --
-- "myQueryResult" in this case)
tell application "Finder"
set myQueryFile to alias ((path to desktop as string) &
"SomeFileOnTheDesktop")
set myFileRef to (open for access myQueryFile)
set tsize to (get eof myFileRef)
set myQueryResult to read myFileRef as string from 1 to tsize
close access myFileRef
end tell
-- use "cell" to identify specific FM Pro fields.
-- create the record then get the number of records,
-- then set the fields in the last record
tell application "FileMaker Pro"
tell database "test applescript"
create new record
set myRecordID to count of records
set cell "first data field" of record myRecordID to 1
set cell "second data field" of record myRecordID to "2"
set cell "third data field" of record myRecordID to myQueryResult
end tell
end tell
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.