Optional Script step primer
Can anyone direct me to a primer on optional script steps. Im sure they can speed up my development if i understood them. Thank you!
What do you mean by an "optional" script step? What Makes them "optional"?
Do you mean a comprehensive list of all script steps and the options that you can select for each?
Sorry! i meant optional script PARAMETER!
There's not much to optional script parameters. If you put an expression in that box--it can be a constant value or a complex calculation, it will be evaluated just before the specified script is performed and then Get ( ScriptParameter ) can access the value passed that way.
You could, for example, set up different buttons that all perform the same script but pass different data as a script parameter to that same script so that you have one script that does different things depending on the button that is clicked.
Thus, passing a single value to a script is simple. Passing multiple values is also possible but more complex.
I often use the list function to pass multiple values though this is not the only method that can be used:
List ( "Apple" ; "Orange" ; "Pear" )
could be entered in the optional script parameter box to pass those three words, separated by returns.
Then Getvalue ( Get ( ScriptParameter ) ; 1 ) would return "Pear". I often set up a set of variables with such individual values at the beginning of the script:
Set Variable [$Parameter1 ; Getvalue ( Get ( ScriptParameter ) ; 1 ) ]
Set Variable [$Parameter2 ; Getvalue ( Get ( ScriptParameter ) ; 2 ) ]
Set Variable [$Parameter3 ; Getvalue ( Get ( ScriptParameter ) ; 3 ) ]
But with more descriptive variable names than these. This makes accessing the individual values in subsequent steps simpler and also serves as a kind of "declaration block" that helps document what kind of data must be passed as the script parameter.
You might find it educational to download the Known Bugs List database and examine the Delete Portal Row script. A multiple value script parameter such as this is used to pass all table, layout and file specific data to the script, thus enabling me to use one such script as a user friendly way to delete portal rows that works on all my layouts and in all my files to delete a portal record from any portal. The lack of any file specific references in the script means that I can use Import Scripts to copy this script into a new file and I do not have to edit any part of the script to fix such broken references.
and just to add my two-bits worth - that Delete Portal Row script is one of the most useful scripts I've come across - thanks Phil!
Retrieving data ...