Re: FMP question
Re: FMP question
- Subject: Re: FMP question
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 01 Nov 2000 14:59:50 -0800
On 11/1/00 1:59 PM, "Shane Stanley" <email@hidden> wrote:
>
On 2/11/00 6:03 AM +1000, Paul Berkowitz, email@hidden, wrote:
>
>
> Thanks. Here it is.
>
>
There's room for improvement there. The key is to keep the number of events
>
to a minimum.
Many thanks, Shane, for all the attention you gave this.
>
>
The first thing to do is to create a new layout (or layouts) in the database
>
that contains only the fields you'll be concerned about, in the order you
>
want to deal with them. By addressing this layout, you can simplify things
>
greatly.
>
>
For example, if there are seven fields you are interested in, you can do
>
this:
>
>
tell layout x
>
create new record at end with data {a, b, c, d, e, f, g}
>
end tell
"with data". Aha! I tried "with properties", and specifying the cells, in
the existing database and got nowhere. But FMP was calculating the other
fields in the existing layout, which I think are still wanted. Can this
method be used somehow with the existing layout?
>
>
This is much quicker than creating the record and then putting in the data
>
(lthough there are quicker ways still, especially if you are importing more
>
than a handful of records at a time).
Could be 50 or more at a time.
>
>
As for your search for duplicates, you're ignoring the whose clause; let FMP
>
do the searching for you (using a new layout):
>
>
tell database 1
>
tell layout y
>
record 1 whose cellValue of cells = {b, f, c, d, e}
>
end tell
>
end tell
Aha, thank you. 'cellValue' looks like a variable, but i see from the
Dictionary that it's an application term, OK.
>
>
Note that this uses FMP's sloppy matching ("Johnson" will match "John") and
>
will give an error if no match is found. So your safest method is to do
>
something like:
>
>
tell database 1
>
tell layout y
>
try
>
set x to record 1 whose cellValue of cells = {b, f, c, d, e}
>
on error
>
set n to ""
>
end try
>
end tell
>
if n {b, f, c, d, e} then
>
tell layout x
>
create new record at end with data {a, b, c, d, e, f, g}
>
end tell
>
end if
>
end tell
>
Where does this n come from in:
if n {b, f, c, d, e} then
And my email couldn't read the character after 'n', what is it? (This may
turn out to answer the previous question too.)
>
That should speed things up quite a bit. But if you're going to be getting
>
more than a handful of records at a time, there are ways that are
>
considerably faster still...
You intrigue me
--
Paul Berkowitz