An Applescript bulk loader I'm working learns all the field names and their
creation order in the database I'm loading, so that I can construct a valid
'Create Record' command. Briefly,
The following command gets the names of all the fields in the DB (Filemaker
automatically defines layout 0 as "every field")
(1) set dbFieldNames to (get name of every field in layout 0 of database
theDB)
Iterating thru this list, I get the field i.d. of each field. Somewhere
it's documented that field ids are floats in ascending sequence by creation,
so I can use this to sort the fields into creation sequence. The command to
get a field id is this:
(2) set dbID to (get ID of field dbFieldName in database theDB)
Using this sorted list I can construct a list of values (theValueList) that
can be passed to FMP as follows:
(3) create new record at end of database theDB with data theValueList
This has worked fine until I recently added a couple of global fields to the
DB. Now, in step (1) dbFieldNames includes the names of those global
fields. But if I construct an ordered list of values for every field in
dbFieldNames, and pass it in step (3) as theValueList, I get an "invalid
data" error from FMP. There are now 15 "normal" fields and 2 global fields,
so I am passing a list of 17 values in the create-new-record, but FMP
(understandably) only wants 15.
Offhand I can't figure out how, in steps 1 or 2, to identify and ignore
global fields.
Does anyone know how to ask FMP whether or not a field is global?
Thanks, Chap
S?ren Dyhr - 27 Feb 2004 06:37 GMT
> Offhand I can't figure out how, in steps 1 or 2, to identify and ignore
> global fields.
>
> Does anyone know how to ask FMP whether or not a field is global?
You're writing to layout 0, but to avoid this do make a new layout
sans the globals and the setting via the iteration is then again 15
...
--sd