› Clovertech Forums › Read Only Archives › Cloverleaf › Cloverleaf › using xlateOutVals with list context › Reply To: using xlateOutVals with list context
Walter,
Since set is s string command and list is a list command they react differently to special characters. The set command produces a simple string and the list command produces a valid list.
hcitcl>set myvar $
hcitcl>puts $myvar
$
The TCL interpreter treated the as a substutition character. So, “$” was evaluated to just $. You’re really saying substutite “$” with $. Then the set command took that value and simply put it into the variable as is.
hcitcl>set myvar
hcitcl>puts $myvar
{$}
In this case two things happen. First, substitution occurs as before and the “$” is substutited with “$”. Then the list command evaluates the $ and decides that since it’s a special character that it should use curly braces to prevent the interpreter from corrupting the list later on.
I’d have to play with it to see what happen when the value is passed back to the destination field. The reason we’ve used list to set xlateOutVals was to guarantee that we passed only one list element. In other words to prevent values that have spaces from being treated as multiple values.
You may have seen the effect before:
set xlateOutVals “hello world”
The field actually contains only “hello”. This is because hello was list element 0 and world was list element 1. If there was only one destination path defined, element 1 has nowhere to go.
So if you want “hello world” to show up in your field then:
set xlateOutVals