3 Replies Latest reply on Aug 28, 2014 12:17 PM by philmodjunk

    Open other database + Find

    wheymans

      Title

      Open other database + Find

      Post

           Hello,

           In our Company we have 2 databases (due to historical reasons)

           Database 1 has a FirstName-field and a LastName-field. Database 2 has a FirstName-field and a LastName-field.

           Is it possible, one way or another, to write a script that:

           1.  copies the data of the 2 fields in database 1 (that's the easy part) 

           2. after that open database 2 (even that is not that difficult i guess)

           3. and after that performs a Find in database 2 for the two fields

            

           If this is possible, i would be a verry happy person.

           Thx in advance,

           Wim

        • 1. Re: Open other database + Find
          philmodjunk

               In database 1, create a script that uses Perform Script to perform a script in database 2. Pass the values of these two fields as a script parameter to that script in database 2.

               example:

               Your expression in the optional script parameter box can be: List ( YourTable::LastNameField ; YourTable::FirstNameField )

               Then your find script can be:

               Go to Layout [specify layout on which you want to perform your find here]
               Enter find Mode [] --> clear the pause check box
               Set Field [YourTable::LastNameField ; GetValue ( Get ( ScriptParameter ) ; 1 ) ]
               Set Field [YourTable::FirstNameField ; GetValue ( Get ( ScriptParameter ) ; 2 ) ]
               Set ErrorCapture ( on )
               Perform Find[]

               Note that this method assumes that FirstNameField in database 1 will never be blank. A different approach to passing multiple values in a single parameter must be used if both fields might at different times be empty.

          Caulkins Consulting, Home of Adventures In FileMaking

          • 2. Re: Open other database + Find
            wheymans

                 Hello PhilModJunk,

                 Is it possible to write this out more in detail for me. I don't quite know what to do in which database when i'm reading your answer. Where should i use the optional script parameter? How to do so?

                 Thanks,

                 Wim

            • 3. Re: Open other database + Find
              philmodjunk

                   In database 1, you have a single line in a script or attached to a button:

                   Perform Script [ "Script Name in Database 2 goes here" from file: "database 2" ; Parameter: List ( YourTable::LastNameField ; YourTable::FirstNameField ) ]

                   The script in database 2 that this script step in Database 1 performs is the script that I posted previously.

                   An alternative approach is to add a table occurrence with an external data source reference to Database 2 inside database 1. Then you can set up a layout to this table from Database 2 in Database 1...