Add the following code to a Custom Script under the Advanced Search dialogue.
1. Messages, Errors, Completed, Inbound, Outbound, or Processing tabs.
2. Click on the Elipsys button next to the search field.
3. Click on Advanced button
4. Click on Insert to add a search condition
5. Change the Type to Custom Script from Standard and add code.
Note:
a) The source.getNode('MSH-7') node path will need to be changed based on your paticular message type and must reflect a date time field within the message of previously processed messages.
b) The rangeInDays numeric value (-5) can be changed to the number of day's back (negative number) from today's date for the search.
var DateUtils = org.apache.commons.lang.time.DateUtils;
var value = source.getNode('MSH-7');
var rangeInDays = -5;
var sourceDate = qie.deduceDate(value);
var today = qie.deduceDate(qie.formatDate('yyyyMMddHHmmss'));
var dateOffset = DateUtils.addDays(today, rangeInDays);
if (rangeInDays > 0) {
return today.equals(sourceDate) || dateOffset.equals(sourceDate) || (today.before(sourceDate) && sourceDate.before(dateOffset));
} else if (rangeInDays < 0) {
return today.equals(sourceDate) || dateOffset.equals(sourceDate) || (today.after(sourceDate) && sourceDate.after(dateOffset));
} else if (rangeInDays === 0) {
return today.equals(sourceDate);
}