• 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.
  • Home
  • /HL7 Code
  • /How can I remove RXA-12, not just delete the value, but remove it?

How can I remove RXA-12, not just delete the value, but remove it?

Question: How can I remove RXA-12, not just delete the value, but remove it so that RXA-13 becomes the new RXA-12?

To do this you can use the simple function below. They way it works is to go through all RXA segments and calls the RemoveAt(12) on the segment fields. This will remove the field causing all fields after RXA-12 to be offset by one.

public override void Run()
{
   HL7Message message = GetParsedMessage();
   foreach(HL7Segment segment in message.GetSegments("RXA"))
   {
     segment.Fields.RemoveAt(12);
   }
    
   this.SaveMessage(message,"RXA-12 Removed");
}