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.

Help with Script to check data with related record

Featured Replies

  • Newbies

Hi!

Database A (master file) is related to Database B. I want to write a script that will allow me to enter a customer number into DB A and then have the script validate/check that there is a related record in DB B. If there is a related record I want to continue entering data in DB A but if there is no related record then I want to be able to enter a new record in DB B then go back to DB A and continue entering data. Can anyone help me with some suggestions?

Cheers

Validating the relationship is pretty easy,

#From Database A

If[ DatabaseB::CustomerID ]

# There is a related record

End If

But this type of check isn't often used for entering new records. What is the data you are working with? Maybe there's a better process.

I want to write a script that will allow me to enter a customer number into DB A and then have the script validate/check that there is a related record in DB B.

If [ IsEmpty(DatabaseB::CustomerNumber) ] ... boolean produces true (1) if there is no related record.

If there is a related record I want to continue entering data in DB A but if there is no related record then I want to be able to enter a new record in DB B then go back to DB A and continue entering data.

There is no need to jump to DatabaseB and create a record. Your relationship itself can do this for you. Turn on Allow Creation of Related. Place a field from Database B on your Database A layout (anything except the CustomerNumber. Let Users enter a value in it, and your related Database B will be automatically created if none exists matching that CustomerNumber.

You can also just take care of this behind the scenes without placing a field from B on your A layout ... use script with the If[] test above. If true (no related record), use script to set any B field (except the CustomerNumber) and your related record will be created and the associated CustomerNumber will be automatically inserted in B for you.

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.