Skip to content

Instantly share code, notes, and snippets.

@seanwalsh
Created December 29, 2014 00:46
Show Gist options
  • Save seanwalsh/4b0d2081538169eb8688 to your computer and use it in GitHub Desktop.
Save seanwalsh/4b0d2081538169eb8688 to your computer and use it in GitHub Desktop.
Custom Function
PassScriptParameter ( Value )
Parameter
Value
Definition
Let ( [
xWord = "|" & Value & "|"; /* WHAT IS THE FILTER TERM WE ARE LOOKING FOR */
xCount = Length ( xWord ); /* COUNT THE LENGTH OF THE FILTER TERM */
xStart = Position ( Get ( ScriptParameter ); xWord ; 1; 1 ) + xCount; /* WERE DO WE START */
xStop = Position ( Get ( ScriptParameter ) ; "|" ; xStart + 1 ; 1 ) - xStart /* WERE DO WE STOP */
];
Middle ( Get ( ScriptParameter ) ; xStart ; xStop )
)
Concept
Use PassScriptParameter to automatically pull out data from a ScriptParameter without knowing exactly where that piece of data is in your ScriptParameter string. Tell PassScriptParameter which value out of your string you are looking for and the custom function will pull it out.
ScriptParameter
Build your ScripParameter with a defined value surrounded by pipes. The final value needs to be followed by a single pipe.
"|FILTERVALUE|" & FieldName & "|"
In my example I want to pass on the value of FirstName. My ScriptParameter calculation would look like
"|FIRSTNAME|" & FirstName & "|" & "|LASTNAME|" & LastName & "|ACCOUNT|"& AccountID & "|"
text would equal
|FIRSTNAME|Sean|LASTNAME|Walsh|ACCOUNT|12345|
Results
PassScriptParameter ( FIRSTNAME ) returns Sean
PassScriptParameter ( LASTNAME ) returns Walsh
PassScriptParameter ( ACCOUNT ) returns 12345
@seanwalsh
Copy link
Author

This was a very old script. I don't use it anymore. I just wanted to store it for posterity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment