Originally posted by Josh Stanek
I have been asked to do a comparison between an MRG segment and the PID.3 segment. The scenario is as follows:
- Look at the MRN in the MRG.1 field.
- Loop through the PID.3 field and compare each MRN in the PID.3 to the value in the MRG.
- If the MRN in the PID.3 field is the same as the MRG.1 field, remove that MRN from the PID.3 list--keeping all other MRNs
Input example:
PID|1|MPI_Num^^^NE|1234^^^FacID^MR~23456^^^FacID^MR|...rest of PID Segment
MRG|1234^^^FacID^MR|||MPI_Num^^^NE
Expected Output
Input example:
PID|1|MPI_Num^^^NE|23456^^^FacID^MR|...rest of PID Segment
MRG|1234^^^FacID^MR|||MPI_Num^^^NE
**The output is the same with the exception that the PID.3 value of 1234 is removed because that value is in the MRG segment.
Thanks for the help!!
Josh