web stats
Mirth Community - View Single Post - Blanking repeating segment's field based on conditions
View Single Post
  #5  
Old 11-26-2019, 01:09 PM
Ozz Ozz is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 48
Ozz is on a distinguished road
Default

Quote:
Originally Posted by stormcel View Post
well, I didn't test it, but it should work.
If you like you can add loggers to track everything.
i.e.
Code:
i=0;
if (msg['MSH']['MSH.9']['MSH.9.1'].toString() == 'ADT')  {
logger.info('found ADT');
     for each(nte in msg.NTE)  {
i++;
          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.


It seems to have been the first example was missing the "i=0;" at the beginning. I noticed it on the 2nd example, added it, and now it works. Thank you again!
Reply With Quote