Getting rid of curly brackets

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Getting rid of curly brackets

  • Creator
    Topic
  • #52409
    Tom Arrowsmith
    Participant

      I am restricting a string in an xlate to 26 characters

      With the help of some here – and with a slight modification – I have been using the following code snippet in the xlate with success:

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

      set xlateOutVals

        BUT – the output in the HL7 messages has curly brackets “{}” around the string. This makes it look like this: …|{3300 GALLOWS RD}^…, if less than 26 characters, and like this: …|{611 SOUTH CARLIN SPRINGS R^… if the original string exceeded 26 characters.How do I get rid of the curly brackets? Or is there a more elegant solution?

        Thanks!

    Viewing 2 reply threads
    • Author
      Replies
      • #74091
        Jim Kosloskey
        Participant

          Tom,

          Change this:

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

          to this:

          set tmp [string range [lindex $xlateInVals 0] 0 25].

          Also is the Source in your COPY that does the Tcl a component field and you are pointing tothe entire field?

          Do you want to limit the entire field in the above case or just some component?

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

        • #74092
          Tom Arrowsmith
          Participant

            That did it…..

            I am pointing at a sub-component field (STF11.1) and wish to confine it to 26 characters. I have the entire field in the variant set to 106 characters – but did not know of any way to restrict a sub-component to a particular value.

            In this case, the sending system, MSOW, can send up to 50 characters in this sub-field (not likely, however) and the downstream can only take 26….

            Working for now, with your suggested change……

          • #74093
            Jim Kosloskey
            Participant

              Tom,

              Here is why what happened happened:

              The xlateInVals is a list.

              The component has this value “3300 GALLOWS RD”. Note the white space so when Cloverleaf builds the xlateInVals as a list the “3300 GALLOWS RD” will look like this {3300 GALLOWS RD} so that the entire string become a list element.

              Now when you use lindex without an index value as you first did you get the entire list (only has one element but you also get the curly brace delimiters).

              By specifying a index “lindex $var 0” you get the first (and in this case only) element and lindex strips off the curly braces.

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

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