Hey, Shelbi, we do something like that here for a PACS system that doesn’t like lines greater than 70 characters. Here’s the xlt proc we use. I’m sure there’s a more elegant way to do it, but it works for us. It splits the field on a space character, then builds lines word by word until it reaches the max line length(which you’d need to change). If adding a word to the line exceeds the max line length, it starts a new line.
HTH,
TIM
#############################################################################
# Title: Rad_DR_BI_Format_Result_Text
# Purpose: This translation operation proc formats
# result fields into textual results with
# standard lengths to make a more uniform display in
# Meditech
# Author: Tim Pancost
# Date: December 2010
#
# Input: result
# Output: result
#
proc Rad_DR_BI_Format_Result_Text {} {
upvar xlateInVals xlateInVals xlateOutVals xlateOutVals
upvar xlateInList xlateInList xlateOutList xlateOutList
upvar xlateId myxpmId
# Set internal variables
set newResult “”
set result [lindex $xlateInVals 0]
if {[string length $result] > 70} {
set resultList [split $result ” “]
set resultLine “”
set resultLineLength 0
foreach word $resultList {
set wordLength [string length $word]
if {[expr $resultLineLength + $wordLength] > 69} {
lappend newResultList $resultLine
set resultLine $word
set resultLineLength $wordLength
} else {
append resultLine ” ” $word
incr resultLineLength [expr $wordLength + 1]
}
}
lappend newResultList $resultLine
set newResult [join $newResultList ~]
set newResult [string trimleft $newResult]
} else {
set newResult $result
}
xpmstore $myxpmId [lindex $xlateOutList 0] c $newResult
}
Tim Pancost
Trinity Health