OBX length is 80 char but rec app wraps at 78 chars

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf OBX length is 80 char but rec app wraps at 78 chars

  • Creator
    Topic
  • #48549
    April Adkins
    Participant

      Would appreciate anything anyone is willing to share.

      Problem:

      sending application sends OBX with 80 characters (PICIS OR) ; receiving application “wraps” at 78 characters.  Neither vender is able to adjust their interface.   Need to format the OBX segment in Cloverleaf.

      The suggestion from receiving vender:

      Format the text data within the MDM message to break to a new line

      when they want it to break to a new line.  The break has to occur before 78

      characters or HCI (McKesson Horizon Clinicals)  will auto wrap.  There are a couple ways to do that – basically

      insert a control character into the text in the appropriate place (use

      a carriage return).  The other option is to just space it out using white space.  

      Thanks,

    Viewing 0 reply threads
    • Author
      Replies
      • #58956
        Tom Patton
        Participant

          Here is a snippet of code.

          This code gathered up multiple OBX:5 strings which might have had the repeat (~) char embedded.  At the end of each append, it placed another ~ so you get something like this in $fullReport:

          text line~ text line text line text line~text line~ etc. some text lines being way longer than the allowable -75 chars in our case.

          This snippet will split $fullReport on the ~ and then evaluate the length of each list item.  If it’s longer than 74 chars, then the list item is broken up into 74 byte (or less to get whole word) chunks placing them into $newOBX5.

          Hopefully you can pull somthing out of this that you might use.

                       #  


                        #  now create the OBX segment

                        #  LCR can only handle 74 characters, so break up any

                        #  lines larger than this.

                        #


                        set res_split [split $fullReport “~”]

                        set newOBX5 “”

                        foreach resline $res_split {

                            #  echo resline $resline

                            set reslinelen [clength $resline]

                            if {$reslinelen < 76} {

                                append newOBX5 “~” $resline

                            } else {

                                set begofstr 0

                                set endofstr 74

                                set savlinelen $reslinelen

                                while {$reslinelen > 76} {

                                    # locate the begining of the word the string land on

                                    # subtract 1 to get to the space before

                                    set endofstr [expr [string wordstart $resline $endofstr] – 1]

                                    #echo “next line” [string trim [crange $resline $begofstr $endofstr]]

                                    # trim the text to left justify the line

                                    append newOBX5 “~” [string trim [crange $resline $begofstr $endofstr]]

                                    #  echo newOBX5 $newOBX5

                                    # now get the difference between begining and end of string

                                    # so we can piece out the lines in the paragraph

                                    set diff [expr $endofstr – $begofstr]

                                    # add a char so the same char isnt repeated

                                    incr begofstr [expr $diff + 1]

                                    incr endofstr  75

                                    set reslinelen [expr $reslinelen – $diff]

                                    # echo reslinelen $reslinelen

                                    # echo begofstr $begofstr

                                    # echo endofstr $endofstr

                                    # echo savlinelen $savlinelen

                                }

                                ## get the last one

                                append newOBX5 “~” [crange $resline $begofstr $savlinelen]

                             }

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