Jump to content

Copying Data after clicking "Yes"


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

Recommended Posts

  • Newbies

I have two database files. I have created a printing scripts that asking if everything is OK. If they click "Yes" I want FileMaker to take Database-1 fieldA info into database-2 fieldA. Then database-2 will do its job. I need this to happen in two seperate fields. This will allow database-2 to create reports from many different databases. I have set all the scripts up just can't make it copy the info from one to the other. It should only copy the info from the current record in database-1.

Thank you.

Link to comment
Share on other sites

If you are only copying from the current record into database-2, then this might be another use for a constant relationship. Make a number calculation field in each database, where the calculation is simply the number one. Set up relationships between database-1 and database-2 (both ways) based on the constant fields.

Make two global fields in database-1, call them g_FieldA and g_FieldB (you said you needed to copy from two fields, if there is more, just make more globals).

When the user clicks "Yes", additional script steps need to be included in the script that is running:

SetField (g_FieldA, FieldA)

SetField (g_FieldB, FieldB)

Now have your script call an external script in database-2. The fields you need to fill in database-2 will, presumably, be contained in a single record that is either the only record in the database, or a found set of one. If this is not the case, then the external script will need to isolate the correct record.

The external script fills the two fields in database-2 from the global fields across the constant relationship:

SetField (FieldA, CONSTANT::g_FieldA)

SetField (FieldB, CONSTANT::g_FieldB)

Whenever possible, I always use SetField instead of copy & paste. The script is much more stable that way as it is not dependent on your clipboard, and the fields being set do not have to be visible on the active layout.

If all this needs to happen on more than one record at a time, you will need to build a loop into both scripts.

Steve Brown

Link to comment
Share on other sites

This topic is 6543 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.