David Nelson Posted January 28, 2012 Posted January 28, 2012 It is me again. I found so many hits when I searched script parameter I realize I will never find what I need. Even only looking in Managing Scripts the list is too long. I have script which has a script parameter on it. This script runs a subscript which needs this parameter. I know I read to 'pass it' somewhere but it was ever explained how. Can Exit Script Result[] be used? the Help on it is very confusing and so are the script examples they show. I just need to use the original script parameter in the subscript. How to pass it?
comment Posted January 28, 2012 Posted January 28, 2012 I have script which has a script parameter on it. This script runs a subscript which needs this parameter. Perform Script [ “YourSubScript”; Parameter: Get ( ScriptParameter ) ]
David Nelson Posted January 28, 2012 Author Posted January 28, 2012 No! It can't be that simple!?! I have been looking right at it all the time! And it still uses the same script parameter from the first? I spent half a day yesterday on this silly thing. I thought I read that script parameter only applies to the script where it is defined which would be the first script fired. Much obliged, as always. And thank you for not pointing out what an idiot I am for asking.
comment Posted January 28, 2012 Posted January 28, 2012 And it still uses the same script parameter from the first? Don't get confused: there are two script parameters here. One is the currently running script 's parameter; we fetch it by using Get (ScriptParameter). The other is the subscript's parameter; this is a calculation specified in the Perform Script[] step. Since you want to pass the current script's parameter value, you tell the calculation to fetch it.
David Nelson Posted January 28, 2012 Author Posted January 28, 2012 May I give example to be sure I am clear? First script attached to button with ApplicationAmt as script parameter. That script is: Do this and do this and then If Get(ScriptParameter) > 500 Perform subscript [ create discount record ] ... and it is in this script parameter that I would again reference Get(ScriptParameter)? Help shows using evaluate and Let() but does not explain passing it. So if I had another subscript in that subscript, would Get(ScriptParameter) still give me the ApplicationAmt or would it only look back to its parent script (the original subscript)? And if first subscript has different script parameter, only that value would be availble to subsequent subscripts? Well I can test this using data viewer, I think. Maybe question is better this way: Does the script parameter stay available the whole time the original script and its subscripts are running and all I have to do is use calculation Get(ScriptParameter) as a parameter in any of those subscripts to get it (if they have no changed the original script paramater by passing a different one? Or does it need to be passed down the chain of scripts one after the other in order? I doubt I will have subscript of subscript but just in case I need to understand how it acts. As always, I shall research and test it. But your opinion is like absolute gold and it would save me some brain power which is funny after my soap box rant on another thread. But this subject has tuckered me out. Just getting clear on this important issue would be really great.
comment Posted January 28, 2012 Posted January 28, 2012 LOL, I can see how it can get confusing, although it is very simple. Each script has its own parameter, and only its own parameter. Consider this example: Script A: Show Custom Dialog [ Get ( ScriptParameter ) ] Perform Script [ “Script B” ; Parameter: Get ( ScriptParameter ) / 2 ] Show Custom Dialog [ Get ( ScriptParameter ) ] Script B: Show Custom Dialog [ Get(ScriptParameter) ] If you run Script A from a button with a parameter of 10, you will first see a custom dialog showing 10, followed by another showing 5, and finally 10 again.
David Nelson Posted February 3, 2012 Author Posted February 3, 2012 Now I can pass parameters. Thank you Comment! Your example takes my confusion and makes it understandable. I will keep printed copy of this in case I forget but I doubt it. I thought I read somewhere, actually it was in FileMaker Pro9 Bible where script parameters remain after script runs. I think that threw me also.
LaRetta Posted February 3, 2012 Posted February 3, 2012 ... actually it was in FileMaker Pro9 Bible where script parameters remain after script runs. I think that threw me also. Hi David, I cannot imagine that Ray would say this. It simply isn't so. By any chance, can you remember where in the book you read it?
comment Posted February 3, 2012 Posted February 3, 2012 Perhaps you are thinking about script result - which is sort of the "opposite" to parameter.
David Nelson Posted February 3, 2012 Author Posted February 3, 2012 I found the place in the book because I tagged it because it was confusing. It says script variables remain after script ends and does not say parameters. Variables, parameters, they seemed the same to me but now I realize they are not. I am glad I mentioned it. Thank you for noticing.
Recommended Posts
This topic is 4677 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