set tmp [string trimleft [lindex $xlateOutVals 0]]; set xlateOutVals [list $tmp]
Remember that xlateInVals and xlateOutVals are lists.
That didn’t seem to work either. I’m curious if it is something else. I assume that I can rule it out because when I DEACTIVATE the COPY command, the field does not get copied. And it is empty. So when I REACTIVATE the command, the field is present.
And the leading white space is still present. This is where I put in the TCL fragment, save the xlate, and rerun it through the XLT testing tool without any success.
Well, Max’s solution should work. Put in some ECHOs to show the field values when testing the xlate in the testing tool; maybe something else is going wrong here.
I’m not quite sure why it works now but all I did was remove the code from the PRE-TCL window, saved the file, re-pasted it into the window, and now it works!
In your COPY statement, if the field specified in the Source contains
Quote:
Dallas TX
the leading spaces are part of the list element contained in xlateInVals. Internally, xlateInVals is holding that data as
Quote:
{ Dallas TX}
When you try to remove the leading spaces from the list by using [string trimleft $xlateInVals], there aren’t any leading spaces because those spaces are part of the first list element, not the beginning of the list itself. Your code should read
Code:
set xlateOutVals [list [string trimleft [lindex $xlateInVals 0]]]
The lindex and list commands are important steps for dealing with those internal curly braces.
Author
Replies
Viewing 5 reply threads
The forum ‘Cloverleaf’ is closed to new topics and replies.