mcyrulik Posted March 29, 2011 Posted March 29, 2011 Hey guys, We have a system(system2) where we set the SCBaseURL in a script that fires on system open. We then have another system(system1) that has an External File Reference to system2 to display some data. There is a link on a layout in system1 to view a record in system2. When a user clicks that link, another window pops up with the record from system2. The record that show in system2 has a portal of component records(so we have to use an unstored calc to get the SC to show). When you navigate to the record in system2, we get errors in the containers in the portal. My guess is that the SCBaseURL is not set because the file was opened through an external file reference. Is there a way to get that SCBaseURL to be set even when the file is opened in this manner?
Smef Posted March 29, 2011 Posted March 29, 2011 The best way to do this is to set your SCBaseURL is in the startup script for your database. The startup script will be called in filemaker even if it is opened by another database file. However, you may need to double-check with the script debugger and make sure that SCSetBaseURL is being called correctly when opening the file2 from file1 and is actually running and is not returning "ERROR". You are likely opening it with a different permission set or through some other method that may be causing a slight change in your startup script logic, which could potentially cause your script to skip your setbaseurl script step.
mcyrulik Posted March 29, 2011 Author Posted March 29, 2011 The first line of the system open script for file2 is a setVariable to the result of the SCSetBaseURL function. When file one is opened, and the user navigates to a layout that views data from file2, the system open script of file2 does not fire. The file shows when you select the Window menu, and select show window, file2 is there. When you select it, the system open script does not fire. Could I use a let() statement that calls the SCSetBaseURL function, then calls the SCGetContainer function? Aside from being more traffic to the SC server, and being at best a questionable programming practice, what are the ramifications of doing this? ~Mark
Smef Posted March 29, 2011 Posted March 29, 2011 The opening script only fires when the file is initially opened. When you select the file from the Windows menu the file is already opened, and so all the opening scripts in file2 would have been fired already. I suspect that file2 is opened when you launch file1, and your baseURL is set in file1 after the file2 URL is set, overwriting your base URL settings. You may want to add another script in file1 somewhere to re-trigger the startup script or re-trigger your setbaseURL function before you switch over to file2, and then another script to set your baseURL back to the file1 base URL when you are finished with file2.
Recommended Posts
This topic is 4986 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