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.

How To Get Script Parameter by Number

Featured Replies

We needed a solution to pass many parameters to a function, and to quickly retrieve them throughout the script. Our parameters also has spaces in them, so we used the "~" as a delimiter.

We have a custom function called:

getScriptParameter( parameter ; number)

The code for the custom funciton is:

If ( number=1;Left (Get(ScriptParameter); Position (Get(ScriptParameter) ; "~"; 0 ; 1 ) -1) ; If ( number=(PatternCount ( parameter ; "~")+1) ; Right ( Get(ScriptParameter) ; Length(Get(ScriptParameter))-Position ( Get(ScriptParameter) ; "~" ; 0 ; PatternCount ( Get(ScriptParameter) ; "~" ) ) ) ; Middle ( Get(ScriptParameter); Position (Get(ScriptParameter) ; "~"; 0 ; number-1 )+1 ; Position (Get(ScriptParameter) ; "~"; 0 ; number )-Position (Get(ScriptParameter) ; "~"; 0 ; number-1 ) -1)))

An example of use would be in on a button running a script and passing as parameters:

myfield1 &"~" & myfield2 & "~" & myfield3

Then, when inside of the script, if you want to get the value of myfield2, you can call the custom function by using:

getScriptParameter(get(scriptParameter); 2)

The 2 just signifies getting the second parameter.

For naming conventions on the scripts, we name them as:

myScript(myfield1, myfield2, myfield3)

so that you know what order the parameters go in.

Not to rain on your parade, but

Substitute( MiddleValues( Get(ScriptParameter); Number; 1 );

  • Author

Yes, we started with that, however we started passing big text strings, and even some with paragraph breaks, so using the paragraph symbol didn't work from us...so we used the "~".

In that case, all you need to do is convert the carriage returns into nonsensical strings, the tildes to carriage returns, and then convert the strings back to carriage returns after the string is parsed.

Substitute(

MiddleValues( Substitute( Get(ScriptParameter); [

  • Author

Thats definitly another way to look at it.

Which ever delimiter people try to use I think the custom function is the way to go...or maybe I'm just lazy smile.gif But, if your passing an average of 4-7 parameters to each script, using the middle words and others gets old pretty fast...So, for us its nice to just be able to pass a string, and the number of the parameter you want to return to a custom function.

Hi All,

There is one other way you can do this. Take a look at this posting on the custom Function forum at cleveland consulting's site. It talks about a way of using custom functions to establish a property list which allows you to set, retrieve, and pass multiple variables by name.

http://www.clevelandconsulting.com/support/viewtopic.php?t=59

Don

Cougar, I agree. I just thought you might appreciate a simpler, more efficient one. wink.gif

  • Author

Thanks Queue.

Don...Thats also a good technique. Accessing by name could definitly be useful.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.