August 10, 200718 yr 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?
August 11, 200718 yr 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(); }
August 11, 200718 yr 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.
August 11, 200718 yr Is the script itself literally 3 lines and is the field a plain text field -- i.e. standard storage etc?
August 11, 200718 yr 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.
August 14, 200718 yr 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 HTH
Create an account or sign in to comment