Re: filemaker 7 scripting
Re: filemaker 7 scripting
- Subject: Re: filemaker 7 scripting
- From: Bruce Robertson <email@hidden>
- Date: Wed, 13 Oct 2004 20:35:16 -0700
> I am having a problem with filemaker 7.0
>
> when I do a script step
> set y to cell "blah" of every record whose cell "xyz" contains "blah"
>
> I get the data from the cell "blah" of every record that fits the
> description
>
> when I try
>
>
> set y to cell "blah" of first record whose cell "xyz" contains "blah"
>
> I get the same result as using the request for every record
>
> any Ideas
>
>
> any new resources with sample code for FMP 7
Probably should be:
set y to cell "blah" of (first record whose cell "xyz" contains "blah")
Not really a direct response to your question but a general comment on
applescript and FM7:
First of all, I have a a little difficulty believing that you get the result
you say you get; but perhaps that is so.
An important thing when dealing with FM7/applescript is to recognize that
there are very big changes in the data structure and how you need to address
it and you need to be much more complete and unambigous.
A database can now have many tables.
Tables are just tables; there is no such thing as a found set or a current
record in a table.
WINDOWS have current records and found sets.
The same database can have multiple windows open and all the windows could
have different layouts and found sets.
Different layouts within a window can have different current record and
different found set.
Some examples and comments from a discussion elsewhere:
>> Bruce Robertson <email@hidden> speaking of some AppleScript issues noted:
>>> you MUST use non-ambiguous references.
>>
>> Precisely. And that's the way it always **should** have been. Full and
>> explicit syntax, while longer, is easier to understand and to debug in
>> my experience.
>
> So lets say you have a database name D with internal tables T1 and T2. In
> the relationships graph you have table TO1 and TO2 pointing to internal
> tables T1 and T2 respectably. I've also added another table "TO2'" that also
> points to internal table T2. Layouts L1, L2, L2' use the above tables and
> I've put five records into TO2 with three omitted. Just to make everything
> unique I also rename the window to W.
>
> When dealing with layouts, you can be dealing with a subset of the records
> in the table. When dealing with tables you are always looking at all the
> records. So to fully qualify everything you would have syntax like:
>
> count of every record of layout "L2" of window "W" of database "D"
> returns 2 (number of found records)
>
> count of every record of table "TO2" of database "D"
> returns 5 (total number of records in table TO2)
>
> current record of layout "L2" of window "W" of database "D"
> returns { "data" } (contents of the current record)
>
> record 1 of table "TO2" of database "D"
> returns { "data" } (contents of the first record in table TO2)
>
> count of tables of database "D"
> returns 3
>
> I'm not sure of all of the default containment rules but they had to walk a
> fine line between trying to be backward compatible with pre-7 version and
> work with the new data model in 7. The safest syntax, as Steven mentions, is
> the fully qualified forms.
>
> --Clay
Thanks! Just to directly address one more thing for our listening audience.
I think you implied this but we may as well state it outright.
Like the other methods of FM7 data access, you can't get to the base table
and must go through table occurrences.
So this would not work - it refers to the base table:
record 1 of table "T2" of database "D"
However, a table occurrence does not have to appear on any layout. If you
created TO3 on the graph, based it on T2, but did not use TO3 on any
layouts, this would still work:
record 1 of table "T03" of database "D"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden