Mac OS X, Windows
FMP 8, 8.5, 9, 10, 11
Data Organisation Pty Ltd
File Type: None
FileSize: 0 kilobytes
FileMaker scripts allow only the passing of single script parameter. This function allows you to pass multiple scrip parameters which are named and then retrieve them by name in the script to which the parameter was passed.
This custom function "GetParameter ( ParameterName )" is used to unpack a single named parameter from a list passed to the current script as a script parameter.
The script parameter should be a return ("¶") or pipe (”|”) delimited list of the form:
For example the following list might be passed as a Script Parameter as follows
Perform Script ( "Create Contact" ; Parameter: ""FirstName=Daniel" & "¶" & "LastName=Kaan"" )
In the "Create Contact" script, the multiple parameters that were passed can now be referened by name
Go to Layout ("Contacts")
Set Field ( Contacts::First Name ; GetParameter ( "FirstName" ) )
Set Field ( Contacts::Last Name ; GetParameter ( "LastName" ) )
If a parameter is called for that was not passed (eg: GetParameter ( "ShoeSize" ), an empty string is returned.
Because ¶ characters are used to delimit parameters, values containing ¶ characters are returned only with the characters up to, but not inclucing the first ¶ character. If you need to pass parameters which contain ¶ characters, you should use the pipe “|” character as a delimiter instead. The pipe character is reserved even if you use the ¶ for a delimiter, because if the function finds a pipe anywhere in the parameter, it will use the pipe as the delimiter rather than the ¶.
Spaced either side of the “=” sign are optional
Daniel Kaan, Sydney, Australia Tuesday, 3 October 2006
delimiter = Case(PatternCount ( Get ( ScriptParameter ) ; "|" );"|";"¶");
ListOfParameters = delimiter & Get ( ScriptParameter ) & delimiter;
linestart = Position ( ListOfParameters ; delimiter & ParameterName ; 1 ; 1 ) + 1;
paramstart = Position ( ListOfParameters ; "=" ; linestart ; 1 ) + 1;
paramend = Position ( ListOfParameters ; delimiter ; linestart ; 1 ) - 1;
paremlength = paramend - paramstart + 1;
ValueOfParameter = Middle ( ListOfParameters ; paramstart ; paremlength);
ValueOfParameter = Trim(ValueOfParameter)
GetParameter ( “FirstName” )
FileMaker Inc. provides this content on an “As Is” basis, without any warranty, and subject to the terms of the FileMaker Technical Network Agreement. FileMaker makes no representations and is not liable for any content or related information. You may use the content as part of your own solutions and for your customers, but you may not otherwise publicly distribute any content that you did not submit. ©2009-2011 FileMaker, Inc. All Rights Reserved. FileMaker is a trademark of FileMaker, Inc. registered in the U.S. and other countries.