I see no need for the variables to be global variables in your example not that using them should keep this from working.
Using: List ( $variable1 ; $Variable2 ) as your script parameter should work provided that $Variable1 is not empty. If it's empty, then GetValue( Get (ScriptParameter ) ; 1 ) returns the value of $Variable2.
Might that be why it failed?
There is another option that is more complex that will work even when some of the values passed might be null:
Here's an example script parameter from one of my working DB's:
"Let ( [ $Message = " & Quote ( "Tags with Nonferrous metal must have an address." ) & " ; $WindowName = " & Quote ( "ERROR" ) & " ; $ButtonList = " & Quote ( "OK" ) & " ] ; 1 )"
In the script that receives this script parameter, I use:
Set Variable [$Dummy ; Evaluate ( Get ( ScriptParameter ) ) ]
The Let function passed as text in the script parameter is what assigns values to the $Message, $WindowName and $ButtonList variables here. The value 1 is assigned to $Dummy and is then ignored by my script.
That might be why..
to Get around the empty variable Could i use an If ( isempty ($$jobnumber);" "; $$jobnumber) ?
To get around the empty variable, which results in List "sliding the value to the left" to close up the gaps caused by the null values, use the second method that I've described here, or make sure that a harmless non-null value is assigned to the variable.
I've sometimes used:
List ( $Variable + 0 ; $variable2 & " " ; $Variable3 )
You don't have to do anything extra with the last value so you can sometimes just make the last value in the list your "sometimes null" value.
And you don't have to use variables in this expression. The listed terms can directly reference fields instead.
Putting in those spaces is what did it..Was not aware of the sliding left issue.. Thanks for the help
I just wanted to reply to this...I found a solution to the empty variable shifting when using script parameters. Instead of adding $variable & " " you can use if(isempty($variable);" ";$variable) so instead of adding a &" " to everything, you just add to the empty fields.