web stats
Mirth Community - View Single Post - Blanking repeating segment's field based on conditions
View Single Post
Old 11-26-2019, 12:51 PM
stormcel stormcel is offline
OBX.3 Kenobi
Join Date: Mar 2010
Location: Phoenix
Posts: 165
stormcel is on a distinguished road

well, I didn't test it, but it should work.
If you like you can add loggers to track everything.
if (msg['MSH']['MSH.9']['MSH.9.1'].toString() == 'ADT')  {
logger.info('found ADT');
     for each(nte in msg.NTE)  {
          if (nte['NTE.2']['NTE.2.1'].toString() == 'X')     {
logger.info('found an X in NTE.2.1, on NTE number: ' + i);
logger.info('String that was found: ' + nte['NTE.3']['NTE.3.1'].toString());
nte['NTE.3']['NTE.3.1'] = "";
logger.info('String that should be blank: ' + nte['NTE.3']['NTE.3.1'].toString());
logger.info('Found ' + i +' NTE segments');
NOTE: the if for the ADT didn't have a () after toString. Maybe it wasn't seeing the ADT? copy the above and try it out.
Reply With Quote