Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   HL7 Source filter - need help please (http://www.mirthcorp.com/community/forums/showthread.php?t=219012)

pmcnally 03-14-2019 04:48 AM

HL7 Source filter - need help please
I have a source filter that I cannot get working properly and I am looking for some help.

We are currently on 3.5.1 (I will update once I finish this suite of feeds).
This is an ORU feed coming & we need to suppress certain reports from sending in D (draft) status. The report code is in OBR.21 and the status in OBR.25.

This is my code. It is currently suppressing everything in Draft, not just these report types.


for each(obr in msg.OBR)
if(reportType.indexOf(obr['OBR.21']['OBR.21.1']) == -1 && obr['OBR.25']['OBR.25.1'] == 'D') return false;
else return true;



kirbykn2 03-14-2019 06:37 AM

use logger.info() statements to log your variables.

agermano 03-14-2019 03:22 PM

  1. You have to use obr['OBR.21']['OBR.21.1'].toString() for your indexOf parameter. Otherwise you are passing it an xml object that will never match with a string.
  2. If you intend to check that the array contains the value you want to check the return value != -1. A value of -1 indicates that it was not found.
  3. Your for each loop is unnecessary since you always return after checking the first obr segment. You need some additional logic if you need to check that all segments qualify or at least one qualifies vs only checking the first one.

All times are GMT -8. The time now is 02:26 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation