Jump to content

If there is no relationship


BeckyMN
 Share

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

Recommended Posts

I have a couple FM files from pre 7 days. The files are related to each other but there are no portals in either file.

What I would like to do is create a script in one file that will take me to the related record in the other file if there *IS* a related record. If there is *NO* related record then I want go just go to the file anyway and browse all records.

Here is my script with all of the fluff removed:

Set Error Capture On

Go To Related Record

If Get ( Last Error ) = 101 // no related record

Open File ["The Other File"]

End If

When I run the script, if there is actually a related record it seems to locate it but the window never becomes active. It think this is because the script in the source file is not finished. The same thing happens if there is no related file. It probably goes there but comes back to the original file to finish the "End IF" statement.

I've hit this problem in the past and came up with some pretty clunky workarounds which I would like to avoid this time. I'm hoping one of you more experienced developers can show me how you would handle this situation.

Link to comment
Share on other sites

Mikhael,

Thanks for the help but I may have confused the issue by mentioning the the database was designed before version 7. It is now in fact on version 7. It was converted to v7 last year. I only mentioned that to illustrate that the tables are in different files. I guess I confused the problem and I should have been more clear.

I did try adding a couple of HALTs but it's not working for me either. Again, I'm thinking it is because they are inside if the "IF" which means that the script has to return to the source file to complete.

Becky

Link to comment
Share on other sites

Try something like this.

If [ IsEmpty ( File_two::PrimaryKeyID ) ]

Open File ["File2"]

Perform Script [ "ShowAll" from File: "File2" ]

Else

Go to Related Record [ Show Only Related Records; From table: "File2"; External; Using Layout "Layout1" (File2) ]

End If

Link to comment
Share on other sites

Also I would recommend that if possible, either merge all file that need to be merged. Or, copy the layouts from the second file into the main file and have a Table Occurence represent the second external file.

By doing it this way, you can call the script in and do your checking via the Main file.

Link to comment
Share on other sites

This topic is 5761 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
 Share

×
×
  • Create New...

Important Information

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