infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Cloverleaf
remove \F\ or \T\ or \R\ or \T\ from an HL7 field
jdInforComm
Hello - I need to remove occurances of \F\ or \T\ or \R\ or \T\ within a field in HL7 Oru messages. How can I remove the occurances within an xlate? Thanks in advance.
Find more posts tagged with
Clovertech
Comments
System
Originally posted by Scott Caldwell
Here is how I am doing it with removing a "\.br\" via script:
set lstSegments [split $origMsg \r]
#loop through segments
#echo "foreach line 153"
foreach valSeg $lstSegments {
set segType [mjhGetField 0 $valSeg $fieldSep]
# ------------------------------------------------------------------
# ------------------------------------------------------------------ MSH
# ------------------------------------------------------------------
if [cequal $segType NTE] {
#echo $valSeg
set CountVal 1
set CheckString [mjhGetField 3 $valSeg $fieldSep]
set MarkupExists [string match *\.br\* $CheckString]
while { [cequal $MarkupExists 1] } {
#echo "loop start"
#echo equality:[cequal $MarkupExists 1]
#echo [string first "\\.br\\" $CheckString]
#echo [string range $CheckString 0 [string first "\\.br\\" $CheckString]-1 ]
set valSeg [mjhSetField [string range $CheckString 0 [string first "\\.br\\" $CheckString]-1 ] 3 $valSeg $fieldSep]
set valSeg [mjhSetField $CountVal 1 $valSeg $fieldSep]
lappend newMSGx $valSeg
#echo $valSeg
set CheckString [string range $CheckString [string first "\\.br\\" $CheckString]+5 end]
#echo $CheckString
incr CountVal
set MarkupExists [string match *\.br\* $CheckString]
#echo MarkupExists:$MarkupExists
#echo CountVal:$CountVal
if [cequal $MarkupExists 0] {
set valSeg [mjhSetField $CheckString 3 $valSeg $fieldSep]
set valSeg [mjhSetField $CountVal 1 $valSeg $fieldSep]
#lappend newMSGx $valSeg
}
}
}
lappend newMSGx $valSeg
}
Paul Bishop
You can do it with a string map command without looping through and finding each occurrence. I do question why they need to be removed - those are valid escape sequences in HL7 that should be replaced in the destination system when the message is filed. For example, "\R\" would be replaced by "~" (assuming "|^~\&" on the MSH segment). I do remember having to do this for a vendor's embedded and encoded PDF one time because they went through and replaced all the delimiter characters in the encoded PDF - made for a magnificent crash when decoding the PDF.
To do it properly, you should pull out the delimiter characters from the MSH field first and use those rather than hard-coding values. Assuming this is done in a UPOC tcl:
keylget args MSGID mh
set msg [msgget $mh]
#separator
set fldSep [string index $msg 3]
set subSep [string index $msg 4]
set repSep [string index $msg 5]
set escSep [string index $msg 6]
set sb2Sep [string index $msg 7]
set map_list [list ${escSep}F${escSep} $fldSep ${escSep}T${escSep} $sb2Sep ${escSep}R${escSep} $repSep ${escSep}S${escSep} $subSep ${escSep}E${escSep} $escSep]
# pull out the field from the message you want to change, for example an OBX-5 value, then use the string map command
set obx_5 [string map $map_list $obx_5]
# then replace the OBX-5 value in the message with the one you just fixed above.
If you need more detail on the pulling out and replacing of fields, I can provide that information as well.
Doing this within a translate is also possible, although I've never done it that way. Same concept, just a TCL fragment on the OBX-5 copy.
Jim Kosloskey
Depending on the CL release this can be done with the STRING Action map Function as well.
It is still a good idea to use the MSH indicated escape character just in case the message uses something different than the standard. That can be acquired as well using the STRING Xlate Action.
If you are not familiar with the STRING Action and all of its actions, I have a presentation describing what is available. If you would like that, email me.
jdInforComm
Thank you - I'd need to play around with the tcl. Good reference though. Can it be down via xlate?
jdInforComm
Thanks - good reference; I'm hoping to this this in an xlate if possible.
jdInforComm
Thanks - looking at the string map option. Seems to work from tclsh prompt. Now try in xlate. Appreciate the offer, I may be ok, will find out this afternoon.
Charlie Bursell
Simple if it is just one field.
In translate caputure the field then:
set inp [lindex $xlateInVals 0]
set xlateOutVals [list string map [list "\\R\\" "" "\\F\\" "" "\\t\\" ""] $inp]]