1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
797 views
by js-6370 (360 points)
Under the Search Message dialog there is a handy dandy Date Range option. Is there a way to use the date range option and set some search parameters through the advance search?

1 Answer

0 votes

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);
}
by gary-t-8719 (15.1k points)
by js-6370 (360 points)
Very cool. So on the Search Messages dialog it looks like it looks at the time stamp that is on the message detail. Is there a way to search that value instead of a date that is in the actual message? I am curious because we have multiple channel interfaces that a message might not contain a date.
by gary-t-8719 (15.1k points)
Not at this time, however we do have a enhancement to sync the standard search features with the advanced search features.
by js-6370 (360 points)
Sad day. Well I look forward to seeing the enhancement down the road when it is available. Thank you for your help.
...