Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Are variables interchangeable between files or are they restricted to the file that initiates them?

Cheers,

~Genx

Posted

Global variables terminate upon file close and can only be used within a file. Script variables terminate upon script-end. And I think that script variables can AFFECT other files so would be considered 'to be used in other files' (because the other file's file reference and table occurrence would be in the current file) but I have not tested this yet. :wink2:

Why don't you run tests for us? There are many secrets there yet uncovered!

The most exciting ways to find answers is in DOING. Oh, it can be quite addictive! I'd sell my soul to have the time just to explore FileMaker fully ...

LaRetta

Posted

...Well, the script seems to terminate as soon as the file is closed, so that doesn't seem to help out too much. I'm trying to close the file and then re-open it again (by storing its filepath as a variable) in the same script. Still experimenting, but if anyone can cut down my experimentation time a bit, that'd be great!

Cheers,

~Genx

Posted

"I'm trying to close the file and then re-open it again in the same script. "

A script terminates when the file is closed so the same script can't open the file again. If you explained what you are trying to accomplish, I would bet there are other methods available. I have NEVER had to close a file and reopen it - particularly when we are talking about a served solution. :wink2:

Posted

Okay, well... I was having this discussion in another topic, however, i need to refresh my file references (in the front end) and preferably log the user back-in (I have a login screen with global fields that get set as variables following a successful login). The only way to achieve this, seems to be by re-opening the front end file (talked to FM support, they seem to agree).

This needs to be done if the wireless connection drops out on any particular client.

Hence my need to do it this way.

P.S. Has anyone ever had an error pop-up saying that there is a license key conflict with the computer your on. I.e. the computer has a license key conflict with itself. This occurs following a disconnection on a wireless connection, after closing FM down and attempting to re-open the file.

If not, i may just re-install FM on the couple of machines that are playing up.

Anyway, ummm... yeah

~Genx

Posted

Ok, well, i managed to get the other file open in the following method:

Send Event (windows formated filepath)

Close Window (main window)

My window title changes following log-in so this worked. However, the variables seem to not want to work so im stuck with the user manually loging back-in which is a bit of a pain but oh well, it will do for now.

Posted

And I think that script variables can AFFECT other files so would be considered 'to be used in other files' (because the other file's file reference and table occurrence would be in the current file) but I have not tested this yet.

Just to clarify: The scope of a script variable is limited to the file it is defined in. If you need to pass values between files, either use globals, script parameters, or the new option in the Exit Script[] step along with the get(scriptresult) function.

Posted

Hi Mike, :wink2:

Thanks for clarifying ... my point was that variables initiated in a script fired in a main file will persist until the script ends - and THAT script can set fields etc. IN other files' data because they are in the main file's graph. I haven't been in 8 long enough to try this but it makes sense to me. Not so?

Posted

Sure, the parent script remembers those variables while a subscript is running, but a subscript in another file won't be able to see those variables. They must be passed explicitly or set into globals.

Posted

"but a subscript in another file won't be able to see those variables."

Gotcha. I never USE subscripts - never needed them since 7. My other files are totally handled within my Main file graph. Now it fits why I haven't thought to test this yet. :wink2:

Posted

Well i need the variable to be pulled from a global variable in the file im closing... i.e. the login and password, the reason for this is that i can't get the values if the connection breaks so at login, i store them as variables before clearing the globals i use for logon.

And i can't cross utilize variables between files. So i may just use an exit script result that results in the password and login ... Then i can parse it out and use them in the other file... or so i hope, i've yet to try it.

Cheers for the help guys,

~Genx

Posted

"Well i need the variable to be pulled from a global variable in the file im closing... i.e. the login and password..."

You can get the account name easily enough, but where are you going to get the password? There is no "Get( AccountPassword )" function, it would be a huge security hole. Even if there was, I know of no "Open File with account and password" script step anyway.

I think you'd have to open a different file, close the old file, then in the other file open the original file again. If all the accounts are setup the same in the files it should be reasonably seamless, and there would be no need to store account names and passwords.

Posted

I think you misunderstood the way i was getting the account name and pass. When a user opens the file, they are logged in as an extremely low priveleged user, with access only to a login screen with a global accountname field and a global accountpass field (concealed) and set as variables and cleared post login. They then put in their details, press login, and the re-login script is run. This way i can a) specify 3 wrong logins before the file and FM itself is closed and :o use the password and login should i need it later.

Open File with account and password script step is re-login...

I'm about confused about your 2nd paragraph...

~Genx

This topic is 6800 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
×
×
  • Create New...

Important Information

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