Re: Field vs. Cell in Filemaker
Re: Field vs. Cell in Filemaker
- Subject: Re: Field vs. Cell in Filemaker
- From: Xandra Lee <email@hidden>
- Date: Wed, 14 Mar 2001 19:57:10 -0500
>
Can anyone shed some light on the difference between these two lines of
>
Applescript...
>
>
tell application "Filemaker Pro" -- v5.0v3
>
name of every field
>
name of every cell
>
end tell
>
>
I thought that 'field' and 'cell' were interchangable. 'Name of every
>
cell' causes Filemaker to hang on me...
>
>
Later,
>
Guy
>
This is classic source of confusion for most FMP Scripters, so I think it
warrants at least a stab (however ignorantly put:
"cell" is normally used to grab VALUE of a particular field for a
particular record, it's a subclass of a record
-- so you must always tell FMP which record(s)
-- this is normally the class you'd use to set the VALUE of a specific
field, or a specific record
ex: set/get cell "Age" of record 1
When you want to set several records values, using "whose" clauses is
generally your best bet
-- although asking for a name of a cell would in fact return field name,
you'd really want to use "every field" for this purpose (since it would
be pointless, to get the same field name for every record" ** see below
for examples
"Fields": (cColumn)
"go across records" ie can refer to multiple records
Accordingly, setting the value of a field would set the value of ALL
records,
so if you say:
set field "Age" to "27" -- set data to a field (it changes ALL records)
set AgeList to field "Age" of window 1 --> you'll get a list of ages
HOWEVER: if you know how many records are showing, you can set multiple
field values by using a list form
--ASSUMING 3 records are showing, you CAN say:
ex:
set field "NickNames" of window 1 to {"John", "Roger", "Sue"}
---------------------------------------
In all cases above, Which record(s) your referring to, depends on what
you choose to address ROUGHLY speaking:
Telling or referring to Database --> every record in the database
Tell or referring to Layout (name or number) or Window (name or number)
-- refers to SHOWN records.
so asking for:
record 1 of database 1 --> first record created in the DB
record 1 of layout 2 --> first shown record
(Where no reference exists, FMP either, uses its default assumption or
BARFS (sometimes bigTime) so it's good practice direct or refer to the
desired object. Someone (I think Steve Blackwell) recently wrote an
exceptional treatise on FMP's assumed references.
-------------------------------------
Since I'm not sure what you were really trying to do here are some
examples of grabbing Field Names:
**TO get the field names of every field in your database you have 2
options:
OPTION 1:
set dbFields to name of every field of layout 0 of database 1
-->List of names of every Field of the database ( using FMP's "hidden"
layout)
-- field names will be listed in creation order
OPTION 2: To get every Field names listed in a desired order:
Make sure Fields are listed in derired order in your Defined Fields
Dialog Box, Create a new Layout, (choose "standard" for layout type) &
FileMaker will auto add every field according to your custom order. then
say:
set allFields to name of every field of layout "All Fields"
** To get names of fields of a particular layout:
set layoutFields to name of every field of Layout "Entry" of window 1
--> names of fields on layout "Entry"
HOWEVER, in direct contradiction to what I said above, (AND IMHO - -
defying all logic)
set shownFields to name of every field of database 1
--> field names of current layout!! go figure....
------------------------------------
Hope this helped, more than confused,
Alixandra
Alixandra Leigh
AceDesign
email@hidden
------------------------------------------
Furniture:
><
http://home.rochester.rr.com/alexleighs/furniture/furniture.htm>
Renderings:
><
http://home.rochester.rr.com/alexleighs/interiors/interiors.htm>