Specimen Source table obr-15 with Ampersands

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Specimen Source table obr-15 with Ampersands

  • Creator
    Topic
  • #53303
    Robert Denny
    Participant

      I have a table for the specimen source coming from a reference lab.

      Every source on the inbound side has ampersands. For example

      B&Blood

      Bite Animal&Animal Bite

      SPUTUM%Sputum

      On the outbound side of the table I have all different types of output, but mostly they look like the right side of the Ampersand.

      for example SPUTUM&Sputum->Sputum

      In this example I am getting &Sputum on the outbound.

      Any suggestions on how to get rid of the Ampersand after filtering through the table?

    Viewing 3 reply threads
    • Author
      Replies
      • #77209
        Daniel Lee
        Participant

          What are you using for your souce and destination for the table entry?  Does your table have “Use Original Value” or “Use Default Value”?

        • #77210
          Robert Denny
          Participant

            In one example of the fields we have

            B&Blood -> Blood

            SPUTUM&Sputum -> Sputum

            We have it configured to use the original value.

            I setup a pre proc to escape all Ampersands in OBR15, but not getting anywhere.

            Here is the code to pre proc

            ######################################################################

            proc escAmpersandOBR15 { args } {

              keylget args MODE mode                 ;# What mode are we in

              switch -exact — $mode {

                 start {

                    # Perform special init functions

                 }

               

                 run {

                    # ‘run’ mode always has a MSGID; fetch and process it

                    keylget args MSGID mh

                    set msg [msgget $mh]

                    set segList [split $msg r]

                       

                       set debug 0

                       set count 0

                       foreach seg $segList {

                           set segID [string range $seg 0 2]

                           if {[cequal $segID “OBR”]} {

                               set obrList [split $seg |]

                               set obr15 [lindex $obrList 15]

                               regsub -all {&} $obr15 {\T\} newObr15

                               set newObrList [lreplace $obrList 15 15 $newObr15]

                               set newObr [join $newObrList |]

                               set segList [lreplace $segList $count $count $newObr]

                               

                           }

                           set count [incr count]

                        }

                        set msg [join $segList r]

                        msgset $mh $msg

                        lappend dispList “CONTINUE $mh”

                 }

                 time {

                    # Timer-based processing

                 }

                 shutdown {

                    # Doing some clean-up work

                 }

             

                 default {

                    #echo “Unknown mode in EscapeAmpersands proc: ‘$mode'”

                 }

              }

             return $dispList

            }

          • #77211
            Daniel Lee
            Participant

              All I can tell you is that you are taking the same path I would take.  Create a pre-proc to replace the & in that field with some other character.  You wouldn’t even have to use the escape sequence and just use some other character if you wanted as that data will just be referenced in the lookup table and not sent to your outbound system.  I can’t really tell from looking at the pre-proc code what’s wrong with it.  Put some debug statement’s in to find what line in your code isn’t functioning as expected and maybe I’ll have some ideas.

            • #77212
              Robert Denny
              Participant

                Good Idea, I hadn’t though of just changing it to a character that will work and then modifying the table to reflect that change.

                Thanks for the idea.

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