Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 248
  • Last Modified:

odd behavior of scriptparameter

i have fm8. i have a button that executes a script that opens another layout with the scriptparameter of "legal".
then i execute another script to return to the original layout with the command of
if [get(scriptparameter)="legal"
   goto layout["legal"(legal)]
else goto layout["detail"(detail)]
end if
but it does not return to the legal layout. with debug on it shows that the if test is false

if i put a set command on a global field as the last command line in the first script. it sets the global field correctly
but when i put it as the first command line before the if statement in the second script it does not set the global field correctly

what could be my problem
0
kauakea
Asked:
kauakea
  • 2
2 Solutions
 
billmercerCommented:
When and how are you specifying the script parameter?

When a script calls another one with a parameter, the value of the script parameter is going to be whatever value was passed to the second script by the first one AT THAT TIME, and that value will stay the same until the script ends.

If you're basing the script parameter on the global field, the script parameter will be whatever the value of the global field was at the
moment the script was called. Changing the global field after that won't affect the script parameter. Frankly, it would be pointless if it did, that would defeat the whole purpose of script parameters.

0
 
kauakeaAuthor Commented:
actually i was passing the scriptparameter on to a global field as a type of test. it showed me that the scriptparameter was set correctly as it left the first script but not picked up by the second script
0
 
lesouefCommented:
it is not supposed to be picked up by the sub-script; if you wanna have this, you need to call the second one by specifying again the script parameter of the parent script; that is roughly:
run script (subscriptname ; get (scriptparameter))
this will pass the argument of the current script to the script it spawns.
in other words, script parameters (should be called arguments in fact) are not recursive (when a script calls a script)
0
 
kauakeaAuthor Commented:
i see, i was confused... i have used the scriptparameter before, but always in the script that it was set for. never for a second script. thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now