truncate free text field in xlate

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf truncate free text field in xlate

  • Creator
    Topic
  • #52612
    Ryan Wilson
    Participant

      I have a large free text field that I need to truncate to 50 characters.  I have the pre proc worked out as this

      set var [lindex $xlateInVals 0]

      set xlateOutVals [string range $var 0 49]

      It works except the output only includes values in the field up to a space.  So if there are spaces in the field it only gets the data up to the first space.

      Ideas?

    Viewing 1 reply thread
    • Author
      Replies
      • #74850
        Jim Kosloskey
        Participant

          Ryan,

          xlateInVals and xlateOutVals are lists.

          So I would use something like lindex to retrieve the needed xlateInVals list item (probably the firs which would have an index of zero).

          I would use something like lreplace for xlateOutVals (again probably the first list item).

          A space is a list terminator in Tcl and thus since those 2 variables are lists you see the truncation you are getting.

          You should ALWAYS treat the variables provided by Xlate (xlateIn… and xlateOut…) as LISTS!!

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #74851
          Ryan Wilson
          Participant

            I see.  Thanks for the help.  I have figured it out now.

        Viewing 1 reply thread
        • The forum ‘Cloverleaf’ is closed to new topics and replies.