Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

script to find records in 2nd database

Featured Replies

I have two related databases, Summary and Data. I want to write a script that does two things:

1) Uses the contents of the key field of the Summary database and finds the contents of that key in both the Summary database and the Data database. (This will yield 1 record in Summary and many records in the Data database.)

2) Performs the Relookup function in Summary so that its fields are populated with data from the Data database.

Can anyone help me?

Thanks,

Thomas

Hi,

If I understand, you want to trigger a relookup of selected records based on a selected ID in the Main file.

The quickest would then be to perform a

GoToRelatedRecords [FileA:ID::FileB:ForeignID-SHOW ONLY]

PerformExternal Script ["relookup"- FileB]

RefreshWindow

where your "relookup" script is

GoToLayout[where the ID is]

GoToField[iD]

Relookup[NoDialog]

HTH

  • Author

Apparently there are some script differences between your version (7) of FM and mine (5.5), because the script elements you suggest I use don't appear in the dialog box of ScriptMaker.

I'm going back to FM Help, but so far, I'm still not sure how it's going to work.

Thanks,

Thomas

The only step that might be confusing is Perform External Script. It would be Perform Script where you specify an External one. The rest are in 5.5, although there are spaces in between the words.

Sorry, French version I have.

But it's a 5.5 script for sure.

Tell us if you have problems with this.

  • Author

Thanks for your earlier efforts, but I'm still trying to make it work.

Let me explain it a different way and then show you what I've come up with so far, and then maybe this is something you can help me with.

I need to perform a find in one database (Summary), go to the second database (Data), perform a find for the same thing in the same field as the first find, and then go back to the original database (Summary), go to the key field, and perform a Relookup.

I can get through about half of this, as shown below:

Go to Layout ["Summary"]

Go to Field ["Key"]

Enter Find Mode [Restore, Pause]

-->when it pauses, I type in the number of the record I want to find, then I hit Continue

Perform Find [Restore]

Copy [select, "Key"]

Go to Related Record [show, "Data"]

Enter Find Mode [Restore]

Go to Field ["Key"]

Paste [select, "Key"]

At this point in the script, I don't know what's wrong, but it doesn't paste the criteria I copied from the Summary database into the Key field in the Data database.

Also at this point, I don't see how to get back to my original database (Summary). I can't use the Go to Related Record, because I'm already in the related record. Instead, how do I tell it to go to a specific file?

Questions:

1) What does the Restore function do?

2) In the scripts you suggested earlier, what is the function of the double colons? (that is, :: ) --is that how you specify a certain file?

3) Any warnings on doing a Relookup without dialogue? Any risk of data loss?

THANKS for any help you can give me. If I can script some of this work that I'm currently doing manually, I might be able to get through several hundred records and go home on time for a change.

_Thomas_

Remove Restore from Enter Find Mode and Perform Find. It will overwrite your manually-entered criteria.

Ugo's simply using the double colons to signify a relationship between the IDs in the two files.

Always back up before testing a Relookup.

Go to Related Record removes the need to perform a find in the related file. If you have a relationship from Key in FileA to Key in FileB, a Go to Related Record [show only related, relationship] step will bring up only records where the related Key matches the current one in FileA.

After the GtRR step, add the Relookup step to 'return' to the same file and perform the relookup.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.