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

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

Recommended Posts

Posted

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.

Posted

Not to rain on your parade, but

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

Posted

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 "~".

Posted

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

Posted

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.

Posted

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

×
×
  • Create New...

Important Information

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