Script Parameters
SeedCodeComplete3.ScriptParameters History
Hide minor edits - Show changes to output
Changed lines 20-22 from:
SeedCode Complete
to:
Inside the script you can then call the #Assign custom function like this
'''#Assign ( Get ( ScriptParameter) )''' and your variables will be populated. We love this module.
!! Parameters in the Calendar
SeedCodeCalendar uses a script parameter syntax to make it easier for you to pass multiple parameters to a script. The syntax (the parameter you'd send to a script) looks like this:
'''#Assign ( Get ( ScriptParameter) )''' and your variables will be populated. We love this module.
!! Parameters in the Calendar
SeedCodeCalendar uses a script parameter syntax to make it easier for you to pass multiple parameters to a script. The syntax (the parameter you'd send to a script) looks like this:
Changed line 17 from:
'''# ("sc_paramter1" ; "Value1 )'''
to:
'''# ("sc_paramter1" ; "Value1 )'''\\
Changed lines 17-18 from:
'''# ("sc_paramter1" ; "Value1 )
& # ("sc_paramter2" ; "Value2 )'''
& # ("sc_paramter2" ; "Value2 )'''
to:
'''# ("sc_paramter1" ; "Value1 )'''
'''& # ("sc_paramter2" ; "Value2 )'''
'''& # ("sc_paramter2" ; "Value2 )'''
Added lines 8-18:
!! Multiple Values using #Parameters
For passing multiple values in SeedCode Complete and SeedCode Control, we use the #Parameters module available [[http://www.modularfilemaker.org/module/parameters/|here]] at Modular FileMaker. There's plenty of documentation there, but basically it's a collection of custom functions that allow you to pass multiple values as named value pairs to the parameter and then have them automatically assigned as local variables in the script. The basic syntax is
'''# ("sc_paramter" ; "Value )''' where sc_parameter is the variable name and Value is the value passed.
Multiple Name Value Pairs can be passed like this:
'''# ("sc_paramter1" ; "Value1 )
& # ("sc_paramter2" ; "Value2 )'''
Added lines 2-9:
The SeedCode Complete and SeedCode Control files use two methods for passing parameters.
The first is to simply use the native functionality to pass a single value. When this method is used the script name should indicate this by putting the parameter name in square brackets.
%center% %newwin width=440px% [[http://www.seedcode.com/rootimages/stikipad/complete13/Parm1.png|http://www.seedcode.com/rootimages/stikipad/complete13/Parm1.png]]
Changed lines 30-36 from:
You can add these two lines, without modification, to any script which you'd like to be able to understand multiple parameters.
to:
You can add these two lines, without modification, to any script which you'd like to be able to understand multiple parameters.
!! Debugging Script Parameters
While our "Explode Parameters" script (the second one above) will let you know if your script parameters are poorly formed, you may want to follow the parameters in the Script Debugger sometimes as well (the script debugger is only available in FileMaker Advanced).
Here is a %newwin% [[http://www.youtube.com/watch?v=aEfumAM_IyU | '''short video''']] of how we do it.
!! Debugging Script Parameters
While our "Explode Parameters" script (the second one above) will let you know if your script parameters are poorly formed, you may want to follow the parameters in the Script Debugger sometimes as well (the script debugger is only available in FileMaker Advanced).
Here is a %newwin% [[http://www.youtube.com/watch?v=aEfumAM_IyU | '''short video''']] of how we do it.
Changed lines 28-29 from:
%center newwin% %width=400px% [[http://www.seedcode.com/rootimages/stikipad/complete/paramscript.png |http://www.seedcode.com/rootimages/stikipad/complete/paramscript.png]]
to:
%center newwin% %width=500px% [[http://www.seedcode.com/rootimages/stikipad/complete/paramscript.png |http://www.seedcode.com/rootimages/stikipad/complete/paramscript.png]]
Changed lines 28-29 from:
%center% http://www.seedcode.com/rootimages/stikipad/complete/paramscript.png
to:
%center newwin% %width=400px% [[http://www.seedcode.com/rootimages/stikipad/complete/paramscript.png |http://www.seedcode.com/rootimages/stikipad/complete/paramscript.png]]
Changed lines 28-29 from:
%center% [img=http://www.seedcode.com/rootimages/stikipad/complete/paramscript.png]
to:
%center% http://www.seedcode.com/rootimages/stikipad/complete/paramscript.png
Changed lines 21-22 from:
We use a script to parse this syntax and return it to the original script as a script result. A second line in the script turns the inbound parameters into local variables. So in our example above, our script would create two variables:
to:
We use a separate script to parse the inbound parameters and return it to the original script as a script result; a second line in the script turns the result into local variables. So in our example above, our script would create two variables:
Changed lines 26-30 from:
You'll see these two script lines (one for the parsing the parameter, one for turning it into local variables) at the beginning of many scripts. Take a look at "New Phone Fax Email { ContactID }" for an example. You can add these two lines, without modification, to any script which you'd like to be able to understand multiple parameters.
to:
You'll see these two script lines (one for the parsing the parameter, one for turning it into local variables) at the beginning of many scripts. Take a look at "New Phone Fax Email { ContactID }" for an example.
%center% [img=http://www.seedcode.com/rootimages/stikipad/complete/paramscript.png]
You can add these two lines, without modification, to any script which you'd like to be able to understand multiple parameters.
%center% [img=http://www.seedcode.com/rootimages/stikipad/complete/paramscript.png]
You can add these two lines, without modification, to any script which you'd like to be able to understand multiple parameters.
Changed lines 15-16 from:
--> Parameters can not contain calculation syntax ( ; + - / = ) or quotes.
to:
--> Parameters can not contain calculation syntax ( ; + - / = ) or quotes. If you need to pass values like these, use the custom function "SeedCode_EncodeOperators" and "SeedCode_DecodeOperators" (introduced in v 2.3) in the script parameters themselves. For an example of this see the scripts "New Invoice from Bid" toward the bottom where we call "Create Invoice Line.." (for an example of encoding of the line's description) and "Create Invoice Line..." for decoding of the description.
Changed lines 15-16 from:
--> Parameters can not contain calculation syntax ( ; + - / ) or quotes.
to:
--> Parameters can not contain calculation syntax ( ; + - / = ) or quotes.
Changed lines 17-18 from:
--> The spaces around the semicolons used to separate name value pairs is important: don't forget them.
to:
--> The spaces around the semicolons and equals signs used to separate name value pairs is important: don't forget them.
Added lines 1-26:
!! How do you manage Script Parameters?
SeedCode Complete uses a script parameter syntax to make it easier for you to pass multiple parameters to a script. The syntax (the parameter you'd send to a script) looks like this:
-> Name = Value ; Name2 = Value2
When you're sending hard-coded information in a parameter, you can just type this into the parameter window when calling a script. If you're sending field data, you'll need to put quotes around the literal (the non-field) parts. Here is an example:
-> "ContactID = " & Contacts::_id & " ; Status = " & Contacts::Status
There are a few things to keep in mind about the parameters you can send in...
--> Values within the parameter can include carriage returns: no problem.
--> Parameters can not contain calculation syntax ( ; + - / ) or quotes.
--> The spaces around the semicolons used to separate name value pairs is important: don't forget them.
!! How are parameters read by a script?
We use a script to parse this syntax and return it to the original script as a script result. A second line in the script turns the inbound parameters into local variables. So in our example above, our script would create two variables:
-> $sc_Name would have the value "Value" ( without the quotes)
-> $sc_Name2 would have the value "Value2"
You'll see these two script lines (one for the parsing the parameter, one for turning it into local variables) at the beginning of many scripts. Take a look at "New Phone Fax Email { ContactID }" for an example. You can add these two lines, without modification, to any script which you'd like to be able to understand multiple parameters.
SeedCode Complete uses a script parameter syntax to make it easier for you to pass multiple parameters to a script. The syntax (the parameter you'd send to a script) looks like this:
-> Name = Value ; Name2 = Value2
When you're sending hard-coded information in a parameter, you can just type this into the parameter window when calling a script. If you're sending field data, you'll need to put quotes around the literal (the non-field) parts. Here is an example:
-> "ContactID = " & Contacts::_id & " ; Status = " & Contacts::Status
There are a few things to keep in mind about the parameters you can send in...
--> Values within the parameter can include carriage returns: no problem.
--> Parameters can not contain calculation syntax ( ; + - / ) or quotes.
--> The spaces around the semicolons used to separate name value pairs is important: don't forget them.
!! How are parameters read by a script?
We use a script to parse this syntax and return it to the original script as a script result. A second line in the script turns the inbound parameters into local variables. So in our example above, our script would create two variables:
-> $sc_Name would have the value "Value" ( without the quotes)
-> $sc_Name2 would have the value "Value2"
You'll see these two script lines (one for the parsing the parameter, one for turning it into local variables) at the beginning of many scripts. Take a look at "New Phone Fax Email { ContactID }" for an example. You can add these two lines, without modification, to any script which you'd like to be able to understand multiple parameters.