Prefixing string but TCL adds { (Curly Braces) and ^ (hyphen

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Prefixing string but TCL adds { (Curly Braces) and ^ (hyphen

  • Creator
    Topic
  • #52342
    Rehman Masood
    Participant

      I can’t seem to find an answer to this so thought I did post up a thread about it.

      I need a fragment of TCL code to put in an Xlate that will add a pre-fix to a string. I was able to come up with the following,

      Code:

      set prefix “CH”
      set deptCode $xlateInVals
      set xlateOutVals $prefix$deptCode

      When I run a test on this translate, I am getting my output as,

      CH{GYNECOLOGY^Faculty^Progress^Note^(SD)}

      Where as the real data incoming was,

      GYNECOLOGY Faculty Progress Note (SD)

      How do I modify my TCL code to give me an output such as follows?

      CHGYNECOLOGY Faculty Progress Note (SD)

      Thanks!

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

          Rehman,

          xlateInVals and xlateOutVals (and their other associated data items) are lists.

          your code does not treat them as lists.

          Use something like lindex in xlateInVals and lreplace on xlateOutVals.

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

        • #73871
          Rehman Masood
          Participant

            Thanks Jim. You mention that, and suddenly my code updated and now it works!

            Code:

            set prefix “CH”
            set deptCode [lindex $xlateInVals 0]
            set xlateOutVals [list $prefix$deptCode]

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