truncating sub-fields

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf truncating sub-fields

  • Creator
    Topic
  • #52399
    Tom Arrowsmith
    Participant

      I have a need to truncate a sub-field to a certain field length in order to accommodate a downstream system’s field length requirement.

      For instance, I need to limit the STF-11.1 to 26 characters.

      In the variant I’m using, I can set the overall field length. It’s set to 106. But I can’t specify sub-field length. So I’m guessing I need to insert a tcl statement in the xlate for that sub-field that will confine it to 26 characters – truncating any extra off the right side of the text string.

      Can someone provide me with that tcl statement? Or if you have a better solution, please let me know.

      Thanks!

      Tom

    Viewing 3 reply threads
    • Author
      Replies
      • #74057

        Something like this might work.

        Code:

        set tmp [string range [lindex $xlateInVals 0 25]]
        set xlateOutVals [list $tmp]

        -- Max Drown (Infor)

      • #74058
        Tom Arrowsmith
        Participant

          Max,

          I get the following error when trying to use this code within an xlate:

          Tcl callout error

          erroCode: NONE

          errorInfo:

          wrong # args: should be “string range string first last”

             while executing

          “string range [lindex $xlateInVals 0 25]”

        • #74059
          Charlie Bursell
          Participant

            You probably want

            string range [lindex $xlateInVals 0] 0 25]

          • #74060
            Tom Arrowsmith
            Participant

              Thanks!

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