splitting a message on two different characters

Homepage Clovertech Forums Read Only Archives Cloverleaf Tcl Library splitting a message on two different characters

  • Creator
    Topic
  • #51686
    Kevin Crist
    Participant

    I have a message that i have to take a specific thing from an NTE and put it somewhere else in the message.

    Below, i want to split diagnosis reason, which is right after the CARD DX and copy it. I know how the get the NTE-3 field it is in but how would i just get the “what” diagnosis? I believe it is always the first one in this group but can be multiple words. Any ideas would be great.

    NTE|1|P|CARD DX,what::HEART BP MEDS,no::PT BLOOD PRES,no::TRANSPORT

    Thanks.

Viewing 2 reply threads
  • Author
    Replies
    • #71284
      Gary Atkinson
      Participant

      You could do this in xltp proc in your translation file.  So, you could split the list based on a “,” and then lappend the elements except the first one.

    • #71285
      Russ Ross
      Participant

      I previously posted a proc (xlt_splitflds.tcl) on clovertech that splits a field using a specified delimiter and maps each of the split fields to the desired output field(s), see URL:

      <a href="http://clovertech.infor.com/viewtopic.php?t=1570&#8243; class=”bbcode_url”>http://clovertech.infor.com/viewtopic.php?t=1570

      Russ Ross
      RussRoss318@gmail.com

    • #71286
      Tom Rioux
      Participant

      Try this (this is assuming that the “CARD DX,” can be anywhere in the field)

      # Grab the value from the field

      set dx [lindex $xlateInVals 0]

      # Find the index of where the diagnosis starts

      set dxidx [expr [string first “CARD DX,” $dx] +8]

      # Find the index of where the diagnosis ends

      set dxend [expr [string first : $dx $dxidx] -1]

      set xlateOutVals

        ]

        4 lines of code to get what you want.

        Hope this helps….

        Tom Rioux

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

    Forum Statistics

    Registered Users
    5,129
    Forums
    28
    Topics
    9,301
    Replies
    34,447
    Topic Tags
    288
    Empty Topic Tags
    10