1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
674 views
by gary-t-8719 (15.1k 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;

by gary-t-8719 (15.1k points)
...