// We can also use the terser to set values
terser.set("/.MSH-3-1", "new_sending_app");
// Let's try something more complicated, adding values to an OBX in an ORU^R01
ORU_R01 oru = new ORU_R01();
oru.getMSH().getEncodingCharacters().setValue("^~\\&");
oru.getMSH().getFieldSeparator().setValue("|");
oru.getMSH().getMessageType().getMessageCode().setValue("ORU");
oru.getMSH().getMessageType().getTriggerEvent().setValue("R01");
oru.getMSH().getVersionID().getVersionID().setValue("2.5");
terser = new Terser(oru);
for (int i = 0; i < 5; i++) {
terser.set("/PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(" + i + ")/OBX-1", "" + (i + 1));
terser.set("/PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(" + i + ")/OBX-3", "ST");