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

Warning: Cannot modify header information - headers already sent by (output started at /home/dbhqne5/public_html/wp-content/themes/creativesans/include/misc/nav.php:31) in /home/dbhqne5/public_html/wp-includes/feed-rss2.php on line 8
Custom Functions – dbhq.net http://dbhq.net Take control of your data. Wed, 09 Mar 2016 17:20:26 +0000 en-US hourly 1 Multiple Parameters for Scripts http://dbhq.net/multiple-parameters-for-scripts/ http://dbhq.net/multiple-parameters-for-scripts/#comments Tue, 14 Apr 2015 02:18:29 +0000 http://dbhq.net/?p=431 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 […]

The post Multiple Parameters for Scripts appeared first on 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.

Options:
None

*/

Let ( [
string = Substitute ( Get ( ScriptParameter ) ; [ “\”” ; “^^” ] ; [ ” ;” ; “;” ] ; [ “;” ; “\” ;” ] ; [ “= ” ; “=” ] ; [“=” ; ” = \”” ] ; [“¶” ; “~~” ] ) & “\”” ;
eval = Evaluate ( “Let ( [” &  string  & “] ;” & Name & ” )” ) ;
result = Substitute ( eval ; [ “^^” ; “\”” ] ; [ “~~” ; “¶” ] )
] ;

If ( result =”?” ; “” ; result )

)

—————-END CODE—————————

The post Multiple Parameters for Scripts appeared first on dbhq.net.

]]>
http://dbhq.net/multiple-parameters-for-scripts/feed/ 1
Creating Custom Functions http://dbhq.net/creating-custom-functions/ Sun, 12 Apr 2015 02:14:06 +0000 http://dbhq.net/?p=426 When we provide instructions for creating a custom function, we will specifically provide any Parameters which need to be defined, and also provide the code for the function. The code will be indicated with the following beginning/ending indicators: ———–BEGIN CODE————————— The actual code will be here. Do not copy the “Begin Code” and “End Code” […]

The post Creating Custom Functions appeared first on dbhq.net.

]]>
When we provide instructions for creating a custom function, we will specifically provide any Parameters which need to be defined, and also provide the code for the function.

The code will be indicated with the following beginning/ending indicators:

———–BEGIN CODE—————————

The actual code will be here. Do not copy the “Begin Code” and “End Code” lines, but do copy everything between them.

———–END CODE—————————

To create the Custom Function, select File—> Manage—>Customer Functions.

 

The Custom Function dialog box appears. Click “New.”

 

In the Edit Custom Function dialog box, enter the Function Name in the top left field.
In the Function Parameters field, enter each parameter separately and click the “+” button to add it to the list.
In the large field that encompasses the bottom half of the dialog box, paste the code we have provided.
Be sure to indicate whether the function should be available to “All accounts” or “Only accounts assigned full access privileges.”

 

Click OK to close all dialog boxes.

The post Creating Custom Functions appeared first on dbhq.net.

]]>