Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

script parameter not getting passed...php

Featured Replies

Can someone tell us what we are doing wrong here. Cannot get the scriptparameter to pass from php to filemaker. The code seems so simple...using php5, server 8v4.

Here is the script:

go to layout (layout name)

new record/request

set field (field_name; get(Scriptparameter))

Here is the php code:

$scriptcommand=&$fm->newperformscriptcommand('layout_name', 'script_name','script_param');

The script executes with no errors but the parameter always comes up empty in filemaker. Is there any permission/setting that would not allow filemaker to receive script parameters?

Try tacking this on the end just to make sure there are no errors:

$scriptcommand=$fm->newperformscriptcommand('layout_name', 'script_name','script_param');

$scriptcommand->execute();



if( FileMaker::isError($scriptcommand) ) {

echo $scriptcommand->getMessage();

}

  • Author

Yeah, we're doing that already. The script executes cleanly with no errors. If we substitute a string literal (e.g., 'November') for the 'Get(ScriptParameter)', everything works as expected. We've isolated the problem to the parameter pass.

Is the script itself literally 3 lines and is the field a plain text field -- i.e. standard storage etc?

  • Newbies

Could there be something problematic about the value that you are passing back to FileMaker -- some sort of character encoding issue, perhaps?

I am guessing that in your actual PHP code the final parameter to newperformscriptcommand() is a variable reference. For testing purposes, what about setting that variable to something trivial (e.g. 'abc') immediately before the call to newperformscriptcommand()? If it works like that, you will know that the problem lies with the content of the parameter, rather than the coding.

Okay, you're right... script parameters never seem to be passed via cwp, whether you do newPerformScriptCommand() or setScript...

I had to come up with something today as a script requiring the addition of around 30 records was taking around 30 seconds.. wayyyy to long.

I created a new table with one field - naturally also a layout. The table and layout are called cwp_scriptParams, and the field called scriptParameter.


$script = $connection->newAddCommand('cwp_scriptParams',array("scriptParameter"=>$parameter));

$script-> setScript('myScript');

$result = $script->execute();





and the script in fm called 'myScript' looks something like this:





Set Variable[$param ; cwp_scriptParams::scriptParameter ]

Delete Record[]

Go To Layout[ required layout ]

#Then do rest of script using $param to address the  script parameter

Now my records take around a second to get added :B

HTH

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.