separating comments

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf separating comments

  • Creator
    Topic
  • #52623
    Kevin Crist
    Participant

      i have to take below NTEs and separate them out. i have to take the first NTE.3 where it says “no thanks” and put that in one field which i can do that part but i have to take the rest of the NTE 1 & NTE 2 segment and combine them to put into another field. The last letters in the first NTE is cutoff and combines with the first letters of the second NTE.

      NTE|1|P| no thanks::REASON FOR EXAM,headache::TRANSPORT MODE,CART AN

      NTE|2|P|D IV::OTH RAD EXAMS TODAY,YES::

      So in the end i would want:

      REASON FOR EXAM,headache::TRANSPORT MODE,CART AND IV::OTH RAD EXAMS TODAY,YES:: to go to one field.

      Thanks for any help or options.

    Viewing 4 reply threads
    • Author
      Replies
      • #74891
        Jim Kosloskey
        Participant

          kevin,

          Assuming Xlate in use here…

          You do not say if there can be more than 2 NTEs but assuming just 2 NTEs:

          Use a CONCAT Xlate Action and specify …NTE(0)#3 and …NTE(1)#3 in the Source and Your desination field in Destination.

          If more than 2 NTEs (indeed an unknown number), ITERATE through the NTEs, concate each NTE(%s1)#3 with a temp variable, when the NTE ITERATE is done, COPY the Temp Variable to your Destination.

          However, what if one NTE ends with a word (Like BACK) and the next begins with a word (like OFF)? Combined that would be BACKOFF – probably not what is wanted. BACK OFF would probably be correct.

          email: jim.kosloskey@jim-kosloskey.com 30+ years Cloverleaf, 61 years IT – old fart.

        • #74892
          Kevin Crist
          Participant

            Thanks Jim, I will give this a whirl. i am using an xlate and i am pretty sure it’s only 2 nte’s but i am doing further testing to make sure. I will let you know how it goes.

          • #74893
            Kevin Crist
            Participant

              ok, i got that part to work but have something else i have been asked to do. i need to trim the comments off at the beginning of this field and they are always at the beginning but i am not having any luck. i have been trying to use trimleft with no luck. should i be using something else?

              i am trying to just remove the “holy cow”. My current code is below:

              holy cow::REASON FOR EXAM,cancer::TRAUMA,YES::TRANSPORT MODE,CART AND O2::OTH RAD EXAMS TODAY,YES::}

              set xlateOutVals [string trim $xlateInVals :]

              Thanks for any help or advice.

            • #74894
              Chris Williams
              Participant

                Kevin,

                Two things:

                (1) string trim removes characters from either end of a string.

                (2) xlateInVals and xlateOutVals ARE LISTS.

                Try something like:

                Code:

                set str [lindex $xlateInVals 0]
                set xlateOutVals [list [string range $str [expr [string first “::” $str] +2] end]]

              • #74895
                Chris Williams
                Participant

                  And did I mention LISTS? The first rule of TCL:

                  “Everything is a list. Even if the list has only one item, it is still a list”

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