Tracy Posted September 23, 2006 Share Posted September 23, 2006 I'm trying to set variables and then use them within scripts and I'm having difficulty with them. The variables are not setting into the fields that I have in the script (using the Set Field step) Some of the layouts/tables that I switch too are not related to the original layout/tables that I retained the scriptparameter from. I guess my question is, can variables be passed to fields that are not related to the table that it was originally set from. It's possible that I'm using the wrong calculation to Set the field, so here is an example: Button has "Optional Scriptparameter" to collect the StudentID. The script's first step is: Set Variable [$$studentID; Get(Scriptparameter)] Now I want to be able to use this variable throughout this script as well as subsequent scripts to follow to pass along the Student ID. This may be too confusing to explain, but I thought I'd give it a shot. Thanks Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted September 23, 2006 Share Posted September 23, 2006 Oughta work, generically speaking. Easy temporary debugging: Show Custom Dialog ["Original Field Value", Table::Student ID, "OK"] Show Custom Dialog ["Script Parameter", Get(ScriptParameter), "OK"] Set Variable [$$StudentID, Get(ScriptParameter)] Show Custom Dialog ["Variable", $$StudentID, "OK"] If the first custom dialog comes up blank, that means Student ID cannot be assessed from the vantage point the script is being run from, which explains your problem. If the first comes up fine but the second is blank, something is amiss in the setting of script parameter. If the first two are fine but the third is blank, the variable is not being properly set for some reason. That's also in decreasing order of likelihood, or so says my hunch. Quote Link to comment Share on other sites More sharing options...
Ender Posted September 23, 2006 Share Posted September 23, 2006 Keep in mind that the scope of variables is limited to the file they are defined in. If you have sub-scripts in other files, you'll need to pass the values in a script parameter or by using a global field. Quote Link to comment Share on other sites More sharing options...
Tracy Posted September 24, 2006 Author Share Posted September 24, 2006 Thanks, I'll give it a try. I was actually able to get around what I wanted to do by setting (unfortunately) a few global fields in the tables. It all seems to be working and after all this time, not sure I want to go back. But I will try the debugging example. Quote Link to comment Share on other sites More sharing options...
Tracy Posted September 24, 2006 Author Share Posted September 24, 2006 Can I use the variable from Set Variable in a Close Window script step? This is done in the same script, same file. Not getting the results I want. Maybe that window has to be active??? Set Variable [$windowname; Value:Get(WindowName)] Close Window [$windowname] Quote Link to comment Share on other sites More sharing options...
AHunter3 Posted September 24, 2006 Share Posted September 24, 2006 Why wouldn't you just do this? -- Close Window [current window] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.