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
Read Only Archives
Cloverleaf
Tcl Library
Remove (Parentheses) from HL7 using Tcl
System
Originally posted by Bill Tipton
Hello,
I'm new to Tcl
I need help in trying to remove (???) the parentheses within an HL7
message using Tcl code. Does someone have a quick and easy way to do that? :?
Find more posts tagged with
Clovertech
Comments
Max Drown
Bill, can your provide a little more detail including some examples?
RobertKersemakers
Hi Bill,
If you mean you want to replace the active Null "" with nothing, then try this:
regsub -all "" $msg "" msg
Jim Kosloskey
Robert,
Pre Cloverleaf(R) 5.7 I don't think that will work as the field's datatype attribute needs to be changed as well.
I think in Cloverleaf(R) 5.7 they have made this much easier to do.
Tom Rioux
If you are truly looking to remove the left paren "(" and the right paren ")" then you may have to do this in separate regsub statements. I assume you are wanting to leave any part of the text that is between the parenthesis and leave it blank where the parenthesis was. Try this:
Lets say the text is:
Long term (current) use of medications.
You will need to double escape the parenthesis in order to replace them:
hcitcl>set text "Long-term (current) use of medications"
Long-term (current) use of medications
hcitcl>regsub -all \( $text "" newtext
1
hcitcl>regsub -all \) $newtext "" newtext
1
hcitcl>echo $newtext
Long-term current use of medications
Hope this helps....
Tom Rioux
System
Originally posted by Bill Marsch
Here is a tcl that you can pass a field to it and remove the left and right parens from and replace them using the "string map" command:
######################################################################
# Name: tpsremoveparen
# Purpose:
# UPoC type: xltp
# Args: none
# Notes: All data is presented through special variables. The initial
# upvar in this proc provides access to the required variables.
# The expected InVal is a field to remove left and right parens
#
# This proc style only works when called from a code fragment
# within an XLT.
#
proc tpsremoveparen {} {
upvar xlateId xlateId
xlateInList xlateInList
xlateInTypes xlateInTypes
xlateInVals xlateInVals
xlateOutList xlateOutList
xlateOutTypes xlateOutTypes
xlateOutVals xlateOutVals
set fld1 [lindex $xlateInVals 0]
if { [clength $fld1] > 2 } {
set y [string map {( "" ) ""} $fld1]
}
#echo n "range is " $y
set xlateOutVals "$y"
}