Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6927 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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 ) ; "

  • 2 weeks later...
Posted

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 & "

  • Newbies
Posted

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.

  • 4 weeks later...
Posted

custom function paramByName(name)


=

Let(ParamValue = Evaluate(

" Let([" & Let(Plist = Trim(Substitute(Get(ScriptParameter);

// Deal with empty parameters

[":";"="];["

Posted

&#8800 is HTML for <> (not equal to). There appears to be a parameter missing after it, specifying what it should not equal.

Posted

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

  • 1 year later...
Posted

See related discussion here: http://fmforums.com/forum/showtopic.php?next_end/1/fid/36/tid/172008/

This topic is 6927 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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