• Inner Harbour Software

    Inner Harbour Software consists of a dedicated team of .Net programmers whose mission is to create exceptional and affordable HL7 products. Please email us at support@HL7Spy.com to contact us with questions regarding our products or services.

How do I remove PR1 segments?

Question:
Let’s say that I have a particular interface that is shipping me bad PR1 transactions, which is killing my interface. The vendor on the other side can’t make a change to his interface just yet, and I want to drop all those bad PR1s and let the vendor catch them up for me at a later date when he’s cleaned his data up. Is there a function that deals with including or deleting particular segments?

Answer:
If you create a new Custom Function and paste this code in, load up some messages with PR1 segments, and press “Run”, the PR1 segments will get stripped out.

 public override void Run()
 {
    // Get an HL7 Message in parsed format
    Hl7Message message = GetParsedMessage();
    // remove any segment with name PR1"
    message.RemoveAll(s=>s.SegmentName=="PR1");
    // save the message into an new tab called No PR1s
    SaveMessage(message, "NO PR1s");
 }