Jump 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.

Featured Replies

I was wondering if anyone could help me with a script. I would like this script to open another file with information that is assocaited with this file and if there is no info. related I would like a field from the original copied into the first field of the second file. This would allow me to enter data that is related to this file or view the inforamtion that had been previously entered. I have a relationship set up but I would like to have the field copied over automatically if there is a new record to be entered. I hope this is clear.

Let me see if I understand you.

You have two files that are related. You want to go from file 1 to the related record in file 2 if such a record exists. If not, you want to create a related record? Is that right?

If so, here's what you do. I'm assuming the the relationship is called "file2|file1ID" (with a relationship based on file1's ID field in both files), and that file2 has an ID field called file2ID.

If [ not IsValid ( file2|file1ID::file2ID ) ]

Set Field [ file2|file1ID::file1ID, file1ID ]

End If

Go to Related Record [ file2|file1ID ]

This checks to see if there is a valid record in file 2 that is related to file 1. If there isn't, the way relationships work will create one with the Set Field statement. Once it is created, or if it already existed, then the script will go to the related record.

Chuck

  • Author

thanks for the help with the copying fields this afternoon. I think I just about have the problem solved. Do I need do define 2 relationships each pointing to file one and two

Ex.

file2|file1ID::file2ID

file2|file1ID::file1ID

If this is the case - Can I define this second relationship when I'm writing the script for it in the other file.

For example when I click the button I would like it to perform the script that I mentioned this morning.

Thanks for all your help - it is greatly appreciated

quote:

Originally posted by Chuck:

Let me see if I understand you.

You have two files that are related. You want to go from file 1 to the related record in file 2 if such a record exists. If not, you want to create a related record? Is that right?

If so, here's what you do. I'm assuming the the relationship is called "file2|file1ID" (with a relationship based on file1's ID field in both files), and that file2 has an ID field called file2ID.

If [ not IsValid ( file2|file1ID::file2ID ) ]

Set Field [ file2|file1ID::file1ID, file1ID ]

End If

Go to Related Record [ file2|file1ID ]

This checks to see if there is a valid record in file 2 that is related to file 1. If there isn't, the way relationships work will create one with the Set Field statement. Once it is created, or if it already existed, then the script will go to the related record.

Chuck

You only need one relationship to make this work.

When I write a relationship like file2|file1ID::file1ID, I mean that the relationship exists in file1. It is related to file2 via file1ID=::file1ID. So I'm referring to the file1ID field in file2 using the relationship file2|file1ID.

Create a relationship to file2 and have the file1ID as the match field on both sides.

These two strings of text:

file2|file1ID::file2ID

file2|file1ID::file1ID

refer to the same relationship, but to different fields in the related file. The relationship name is file2|file1ID. I use this naming convention so that if something goes wrong, I know what file the relationship is to (file2) and I know what the match field in the related file is (file1ID). The field referred to in the first line is file2ID in the file file2. The field referred to in the second line is field1ID in the file file2.

Does that clear things up?

Chuck

  • Author

Hi again,

My major problem seems that I can't set up 2 relationships on the ID field - one for ID1 &ID2

quote:

Originally posted by troypatrick:

Hi again,

My major problem seems that I can't set up 2 relationships on the ID field - one for ID1 &ID2

You don't need two relationships, you only need a single relationship from one file to the other file based on the unique ID field in the first file. The second file needs to have a field that can have the unique ID of whatever record in the first file it is related to.

Chuck

  • Author

Maybe I have something set up wrong besides the relationship. Do you mind if I forward the file to you so you can see what I'm looking at.

Cheers

  • Author

Clarification

When I refer to going to file 2 from file 1 - they are seperate data bases. One is the main data base while the other is a branch of the main that has an ID number in common. That is the only field that they have in common, Does this make a difference.

Cheers

That's exactly what I was picturing.

Chuck

  • Author

Thanks for all your help Chuck.

It works great

Cheers

Create an account or sign in to comment

Important Information

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

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.