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
Cloverleaf
Removing duplicates from PV1_19 HL7 field
System
Originally posted by Sucharitha Manyala
How can I delete duplicates from repeating HL7 field PV1_19?
Find more posts tagged with
Clovertech
Comments
jcobane1
Do you need to remove true duplicates or simply extraneous repetitions (i.e. only want the first repetition, toss the others)?
Jim Cobane
Henry Ford Health
System
Originally posted by Sucharitha Manyala
I want to remove true duplicates like if PV1_19 is "a1~a2~a3~a1~a2" I want to map only "a1~a2~a3" to the outbound.
Jim Kosloskey
Are you using an Xlate?
System
Originally posted by Sucharitha Manyala
I was thinking of doing it in Xlate but looks liek it is easy to do it in TPS proc. So i re-built message and used "lrmdups" command to remove duplicates. It worked for me. Thanks for looking into it.
Charlie Bursell
In Tcl it is easy enough. Jim may have an Xlate method
I will assume you know how to split an HL7 message in Tcl.
Assume sements are in variable segList and separator characters were captured similar to:
set fldSep [string index $msg 3]
set subSep [string index $msg 4]
set iterSep [string index $msg 5]
sep loc [lsearch -regexp $segList {^PV1}]
set pv1 [split [lindex $segList $loc] $fldSep]
set fld19 [split [lindex $pv1 19] $iterSep]
# if order in the list is not important then:
set fld19 [join [lsort -unique $fld19] $iterSep]
# to maintain order (assuming you have Tcl 8.6):
foreach element $fld19 {dict set tmp $element}
set fld19 [join [dict keys $tmp] $iterSep]
# then:
set pv1 [lreplace $pv1 19 19 $fld19]
set segList [lreplace $segList $loc $loc [join $pv1 $fldSep]]
msgset $mh [join $segList r]
return "{CONTINUE $mh}"
Be advised I can and do fat finger some things this is off the top of my pointed head
jcobane1
If your using an Xlate, you could do it within the existing Xlate and simply build a list in a temp variable as you ITER through, comparing the current iteration to the elements in the list of the temp variable. If the current iteration value is in the list simply don't copy it to the outbound side (and don't add it to the temp variable). You would have to keep track of your own iteration variable on the output side though.
Hope that makes sense.
Jim Cobane
Henry Ford Health
System
Originally posted by Sucharitha Manyala
Thanks Charlie and James. I did it in my TPS pre-proc before xlate where I rebuilt HL7 message after deleting duplicates with "lrmdups" command. It seems to be working fine.
Jim Kosloskey
I believe lrmdups also sorts so if order is important you might not want to do it that way.