August 19, 200421 yr Now that we can pass a bunch of stuff via the script parameter I hate having to create a calc to parse it out every time... I created the following Custom Function: My_Scripts ( value ) Substitute ( MiddleValues ( Get ( ScriptParameter ) ; value ; 1 ) ; "
August 28, 200421 yr Ocean West, What a great idea! Wow! I've been doing the parse thing by hand ... Thanks!
September 3, 200421 yr Ocean West -- I really liked this script. I wrote a companion function for it to send the multipart script parameter. I defined 5 funtion parameters: ValueA, ValueB, ValueC, ValueD, ValueE The function is then: ValueA & "
September 9, 200421 yr Newbies Hi guys: As with all things FM; there is another way to do this as well. Download the "Split" CF on Dunning's site and you can use this not only on script params, but elsewhere as well. The CF allows you to decide the split character on-the-fly. A script param may look like this: abc|pwr|xyz. You can get this in your script with a specification like this: Split ( Get ( ScriptParameter ); 2; "|" ) -> returns pwr.
October 2, 200421 yr custom function paramByName(name) = Let(ParamValue = Evaluate( " Let([" & Let(Plist = Trim(Substitute(Get(ScriptParameter); // Deal with empty parameters [":";"="];["
October 8, 200421 yr Smorr, What exactly is the #8800? When you copy and paste your code, FileMaker wants it to be a parameter.
October 8, 200421 yr ≠ is HTML for <> (not equal to). There appears to be a parameter missing after it, specifying what it should not equal.
October 15, 200421 yr I didn't invent this, but I found it so useful and elegant I began using it with the solution I just began building. Here's the custom function: // This system passes parameters to scripts in the form of "Parameter1 = "Param1"; Parameter2 = "Param2"". // This function will extract the named parameter from the full script parameter, so that calling, when the above // was passed, GetParameter( "Parameter1" ), will return "Param1". Evaluate( "Let ( [ " & Get( ScriptParameter ) & " ]; " & ParameterName & " )" ) This is from the Using FileMaker 7 book. Number of parameters are effectively unlimited, can be in any order. Escaping the quotes makes string parameters a bit difficult to read, but I quickly got used to that. I used to use the pipe character as my delimiter, but find this much more flexible. BTW, another technique I use is that when my scripts require a parameter, I place parameter names in parentheses. For instance, I have a script called "Edit Record( TableName, RecordID )" which is meant to take two parameters. Assuming I'm editing a address record that appears in a portal from a contacts table, I could call this with a parameter that looks like: "TableName = "Addresses"; RecordID = "" & AddressesForContacts::AddressID & """ Chuck
December 4, 200520 yr See related discussion here: http://fmforums.com/forum/showtopic.php?next_end/1/fid/36/tid/172008/
Create an account or sign in to comment