Warning: Declaration of My_Walker::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = NULL, $id = 0) in /home/dbhqne5/public_html/wp-content/themes/creativesans/include/misc/nav.php on line 31 dbhq.netMultiple Parameters for Scripts - dbhq.net
A common complaint about FileMaker (https://www.geistinteractive.com/2014/04/07/top-feature-request-filemaker-14/) is the lack of a native method to pass multiple parameters to a script. Many developers have tackled this problem using different methods, including include Word Count, Value Count, delimiting characters, and creating a dictionary. Read more at (http://www.merlyn383.com/home/2011/7/27/filemaker-passing-multiple-script-parameters.html). One of the most straightforward, stable and easy to use is a custom function from SeedCode (http://www.seedcode.com/pmwiki/pmwiki.php?n=SeedCodeComplete2.ScriptParameters).
For simplicity and clarity, we started with the SeedCode custom function, but changed the name from SeedCode_GetScriptParameter to MultiParam. The new name name is shorter, to the point, and reminds you what the function does. At DBHQ, we use this custom function in every database we create. It’s a building block which will be used in other script examples on this blog.
In fact, because we do use MultiParam in every database we create, you’ll probably see us employ it even when a script only needs one parameter and Get ( ScriptParameter ) would suffice. The logic behind this is that it’s much easier to use MultiParam (even when you only have one parameter) than to go back and retrofit if you later decide that your script is going to need more than one parameter in certain circumstances.
The function lets you create name/value pairs, separated by a semicolon. First you pass the values into the script using the “optional script parameter” field when you specify the script you’re running. Type:
“action = start ; status = active”
In the code above, the word “action” is the name of a thing you’re passing. Its value is “start.” The semicolon marks the end of the first pair. Note that the spaces around the “=” and the semicolon are for legibility. If you just run the code together, the custom function will still work, but your parameter isn’t as easy to read.
After you’ve passed the parameters, you’ll use Set variable script steps, one for each parameter you’ve passed, to read and store the values within a script:
Set variable [$action = MultiParam ( “action” )]
Set variable [$status = MultiParam ( “status” )]
In this example, $action is will have a value of “start” and $status will have a value of “active”.
To use a field name in the script parameter instead of static text, use standard FileMaker concatenation:
” action = start ; status = ” & Customer::Status
You can string together as many parameters as you need for your script. Here’s one with three parameters, using a field in the second to illustrate how to construct the parameter when you introduce a field name in the center of it.
“action = start ; status = ” & Customer::Status & ” ; state = ” & Customer::State
Refer to “Creating Custom Functions” (ADD LINK) to see the steps to add this custom function to your database.
The MultiParam function itself has one parameter (Name). The MultiParam function should be made available to all accounts.
—————-BEGIN CODE—————————
/*
Name:
SeedCode_GetScriptParameter
History:
Created by John Sindelar, SeedCode LLC, based on Anton Anderson’s FileMaker Advisor Article of Dec 2005.
www.seedcode.com
Creation Date: 26 Dec 2005
Last Modified Date: 21 Jan 2006
Purpose:
Returns just the named parameter when multiple parameters are passed into a script.
Parameters:
Name
Example:
SeedCode_GetScriptParameter ( “Operation” ) returns “begin” when the script parameter is “Operation = Begin ; Status = Estimate”.
Requires Other Custom Functions:
None
Other Notes:
Where “Name” is the name in a Name/Value pair like: “Operation = Begin”.
Separate Name/Value pairs with semicolons like: “Operation = Begin ; Status = Estimate”.
Quotes are optional in the value: “Operation = Begin ; Response = \”OK\””
Fields can be entered like this: “Operation = Begin ; Status = ” & job::status
If a requested value is not present, the result is blank.
Pingback: Give Users Feedback with Merge Variables - dbhq.net