Jump to content

copying data from one file to another


This topic is 7976 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

this script technically works apart from one snag .. (its only a test script to ensure that the connectivity of files and data function correctly)

tell database "central.fp5"

set accessID to cell "AccessID" of current record as text

end tell

tell database "TBcentral.fp5"

set cell "gAccessNumber" to accessID as text

do script "enter find mode"

do script "perform ID search"

find

set cell "gAccessNumber" to ""

get cell "First Name" of current record

end tell

The two fmscripts "enter find mode" and "perform ID search" are created within the database "TBcentral.fp5", the first script just sets the view to find mode, the second, copies the "gAccessNumber" field into the cell "AccessID" then performs the find.

This is so I can isolate the record in the second databse to update details.

The script does work but only given that I make the "TBcentral.fp5" database visible using:

set visible of window "TBcentral.fp5" to true

placed just before the line

tell database "TBcentral.fp5"

otherwise the applecript can't find the fmscript at line

do script "enter find mode"

- I don't want to have the second database showing at all on screen, as the file is merely a backup of relevant fields that will be accessed by an ODBC application sending the results to an accounts datafile. I'd like th users of the system to just be able to click on an update button for a particular record and it to update the second database in the background. Is there a way around this ?

Maybe using an external script fetaure from the primary database "central.fp5"

I hope i've explained this correctly.

thnx.

Link to comment
Share on other sites

ahh, creating a relationship between the two files, creating a layout which contains the fields i want to update and then use the set Field[ ] command.

I would have to have the screen switch to the newly created layout to do so would i not, whilst the update occurred, then return the user back to the originating screen ?

I can't see a way for this to happen in the background out of view.

Link to comment
Share on other sites

Set Field does not require the field to be on the screen. Setting a field through a relationship does not activate the other database file. Finally the Freeze Window script step will do just that, it will freeze the display temporarily.

However this all will happen so quickly that even if you have an actual script in the other DB, it will at most cause a momentary screen flicker.

I suggest trying this in Filemaker before involving Applescript, unless you really like pain and anguish and really want to waste time.

Link to comment
Share on other sites

Kurt,

Thanks for the wise guidance... I guess I was just making things more difficult than they needed to be .. I don't know why I couldn't see the simplicity in the situation.

I've set up a relationship to the secondary file from the primary and created a scrpt with set Field .. and bang, just what i needed to happen. grin.gif

a valuable lesson learned in simplicity.

Link to comment
Share on other sites

This topic is 7976 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.