Sidebar

How can I filter messages based on a set of values found within a particular node path like OBX-5

0 votes
514 views
asked Apr 12, 2017 by gary-t-8719 (14,860 points)
I want to filter or discard messages based on a list of values that can be controlled by the end user. In my case, we are looking for the existence of specific wording in OBX-5 on an MDM message.

1 Answer

0 votes

1. Setup a System Variable Table named "excludeDocuments". Rename column A to "Summary Line" or some other value and column B to "Exclude". The end user can then add any text value into column A for documents they whish to exclude or discard.

 

2. Setup a Custom Condition Node with a Destination Node connected that is set to Discard.

3. Add the following script into the Condition Node to evaluate the list of values entered into the SummaryLine (Column A) of the table created in step 1. Note: if you changed your column names in the table you will also need to change the corresponding names in the script.

var result = true;
var summaryLine = source.getNode('OBX-5');
var table = qie.parseCSVString(qie.getVariable('excludeDocuments'), true, '"', ',', true);
for (var i = 0; i < table.getRowCount(); i++) {
   if (StringUtils.equalsIgnoreCase('Y', table.getNode('Exclude[' + (i+1) +']')) &&
      StringUtils.containsIgnoreCase(summaryLine, table.getNode('SummaryLine[' + (i+1) + ']'))) {
         result = false;
         break;
   }
}
return result;

answered Apr 12, 2017 by gary-t-8719 (14,860 points)
...