Here’s
an insane way to search and refer to a record on a Remote Database. It takes a
lot of time to search a cell of every record. There has to be a way to script a
Remote Database or why would they include a command like “get remote URL”.
Two basic commands set MyRequest to create new request and
set NewRecord to create new record can’t
return a result from a remote DB. WHY??? Am I not addressing it correct for a
remote db???
set InsigniaDB to "Whatever" --Contents of a cell
to search for
tell application "Runtime"
tell database
"NameOfDataBase.fp7"
--Search
for existing record
show every
record
set
AllRecords to count of records of
window "NameOfWindow"
repeat
with i from 1 to AllRecords
if
cell "Insignia" of record i is
InsigniaDB then
go to record i of
window "NameOfWindow"
exit
repeat
end
if
--No
matching record found, make new record
if
i = AllRecords then
create new record of
window "NameOfWindow"
set
LastRecord to count of records of
window "NameOfWindow"
go to record LastRecord of
window "NameOfWindow"
set
i to (i + 1)
end
if
end
repeat
tell
record i
--Do
whatever
end
tell
end tell
end tell
From: Steve Valenti
Sent: Tuesday, June 15, 2010 4:12 PM
To: 'liste AppleScript US'
Subject: RE: FileMaker - Scripting Remote DataBase
Adding
the "go to layout layoutname" didn’t help. If you take the
command “create new record” it does make a new record but the set
variable gets no reference to it. Then if you try to add “go to
MyRequest” on the next line it will error because the object can’t
be found. What is with Remote Databases. This is like buying on off-road
vehicle and only allowed to drive it on a road…
Steven
Try
throwing a "go to layout layoutname" in there right after the tell
database. For what you're doing, you really shouldn't have to, but I've seen
that work before.
Geoff
On
Jun 15, 2010, at 1:41 PM, Steve Valenti wrote:
I built scripting to
automatically populate a database and everything works great when I open the
database on the machine. Now I need to move this database to FileMaker Server
and open it on a client as a remote database and run my scripting to keep
populating it. However scripting of a remote database doesn’t behave the
same. Here are two examples when trying to script a remote database that you
don’t get any results to work with. If you were to run one at a time it
really shouldn’t error. FileMaker Server 11 doesn’t seem to be the
trouble because I tried just sharing from FileMaker Pro 10 software with the
same results.
tell application "FileMaker Pro Advanced"
tell database "NameOfDataBase.fp7"
show every record
delete every request
set MyRequest to create new request --Error
--Object not found.
(-1728)
set NewRecord to create new record --Error
--Object not found.
(-1728)
end tell
end tell
Does anyone have any experience
in scripting remote databases? The show every record command works. What makes remote DB different?
Thanks!!!