web stats
Mirth Community - View Single Post - Remove 1 OBX line based on beginning text
View Single Post
  #8  
Old 09-02-2015, 07:59 AM
deuteronomy deuteronomy is offline
Mirth Newb
 
Join Date: Dec 2014
Posts: 22
deuteronomy is on a distinguished road
Default not working

Hi, I adapted this javascript to remove any OBX that has ED in OBX 2.1 but some messages, out of thousands thats work, did not remove all the OBX lines

var i = 0;
for each (obx in msg..OBX)
{
if (obx['OBX.2']['OBX.2.1'].toString().substring(0,2).toUpperCase() == 'ED')
{
delete msg['OBX'][i];
logger.debug("Stripping OBX attatchments");
}
i++;
}


eg RAW

OBX|1|ED|REQCARD^REQCARD^||^IM^JPEG^Base64^${ATTAC H:15ef9a75-d8f8-4ffd-99e4-c35217493158}
OBX|2|ED|REQCARD^REQCARD^||^IM^JPEG^Base64^${ATTAC H:26e30c85-bf7a-4068-b843-ea4ffe52b358}
OBX|3|ED|REQCARD^REQCARD^||^IM^JPEG^Base64^${ATTAC H:dddaeb2d-34a2-407c-bb93-a4da2e29644f}
OBX|4|ED|REQCARD^REQCARD^||^IM^JPEG^Base64^${ATTAC H:766b0d5c-7731-4ec6-9bd7-42fc965ee2d8}
OBX|5|ED|REQCARD^REQCARD^||^IM^JPEG^Base64^${ATTAC H:291e0edb-ccf6-443d-b6f0-a16b2d01f459}
OBX|6|ED|REQCARD^REQCARD^||^IM^JPEG^Base64^${ATTAC H:75e2b42e-457a-4025-9f84-cbfe5df06a22}
OBX|7|ED|REQCARD^REQCARD^||^IM^JPEG^Base64^${ATTAC H:5307dbce-6089-423b-ab0e-7d8919a35a54}

SENT

OBX|2|ED|REQCARD^REQCARD^||^IM^JPEG^Base64^${ATTAC H:26e30c85-bf7a-4068-b843-ea4ffe52b358}
OBX|4|ED|REQCARD^REQCARD^||^IM^JPEG^Base64^${ATTAC H:766b0d5c-7731-4ec6-9bd7-42fc965ee2d8}
OBX|6|ED|REQCARD^REQCARD^||^IM^JPEG^Base64^${ATTAC H:75e2b42e-457a-4025-9f84-cbfe5df06a22}
Reply With Quote