Replies: 1 comment
-
Got some help from agermano on the Mirth Connect slack. He pointed me to use java.time classes, and helped me get to this, which is working: `var orc9 = DateUtil.getDate("yyyyMMdd", msg['ORC']['ORC.9']['ORC.9.1'].toString().slice(0,8)); if (msg['MSH']['MSH.9']['MSH.9.1'].toString() == 'ORM' && orc9.getTime() > filtDt.getTime()) { |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to build a filter that compares the ORC.9 date with a set date, and only allow the message through if the ORC.9 date is after the set date. The message I'm feeding in has an ORC.9 value of 202208201401-0600. Below is the code I have written:
`var orc9 = DateUtil.getDate("yyyyMMdd", msg['ORC']['ORC.9']['ORC.9.1']);
channelMap.put("ORC9 = ", orc9);
var filtDt = DateUtil.getDate("yyyyMMdd", 20240819);
channelMap.put("filtDt = ", filtDt);
if (msg['MSH']['MSH.9']['MSH.9.1'].toString() == 'ORM' && orc9 > filtDt) {
return true;
}
return false;`
The message isn't being filtered, even though the ORC.9 date is before 20240819. I have it writing orc9 to the channel map to see how it's interpreting it, and that shows Thu Dec 30 00:00:00 CST 2573. I can't figure out why it's interpreting the ORC.9 date so incorrectly. Any help would be welcomed.
Beta Was this translation helpful? Give feedback.
All reactions