BeckyMN Posted December 18, 2006 Posted December 18, 2006 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.
Mikhail Edoshin Posted December 18, 2006 Posted December 18, 2006 In pre-7 FileMaker activates the file the script (or chain of scripts) ends in. That is to activate the related file in your situation you need have some "Open me" script in The Other File and either - Call it at the end of your script, or - Call "Open me" from any place, but add a Halt step to it.
BeckyMN Posted December 18, 2006 Author Posted December 18, 2006 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
mr_vodka Posted December 18, 2006 Posted December 18, 2006 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
mr_vodka Posted December 18, 2006 Posted December 18, 2006 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.
Recommended Posts
This topic is 6608 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 accountSign in
Already have an account? Sign in here.
Sign In Now