Announcement

Collapse

Mirth Connect 4.3.0 Released!

Mirth Connect 4.3.0 is now available as an appliance update and on our GitHub page.

This is a major release containing new features like adding new functionality to the Mirth Connect Setup Wizard, adding the ability for resource and channel-specific classloaders to load child-first or parent-first, and added a default implementation of the getObjectsForSwaggerExamples() method in the ServicePlugin class. This release also contains enhancements for the Mirth Connect Administrator Launcher, the Mirth Connect Docker images, and several bug fixes and security improvements.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Javascript support

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Javascript support

    What level of javascript support do we have when writing javascript transforms. I'm trying to perform standard date conversion methods and my channel craps out because the .getYear, .getDate etc. doesn't exist.

    I tried using the the formDate method from the reference list and I get

    "Can't find method com.webreach.mirth.server.util.DateUtil.formatDate "

    Am I missing a library of functions??

  • #2
    Re:Javascript support

    Not sure about the specific error but for doing date conversion, the following link may help:
    Best practises - How do I ... ? - DateTime conversion

    Comment


    • #3
      Re:Javascript support

      I'm trying to do the exact opposite of that. I need to go from "04/12/1945" to "19450412000000"

      I tried this but get the error I mentioned previously, "Can't find method com.webreach.mirth.server.util.DateUtil.formatDate "

      Code:
      var dt = Date.parse(msg['dob'].toString());
      var dateString = DateUtil.formatDate('yyyyMMdd', dt);
      tmp['PID']['PID.7']['TS.1'] = dateString + '000000';

      Comment


      • #4
        Re:Javascript support

        Code:
        var datestring = DateUtil.convertDate("MM/dd/yyyy", "yyyyMMdd", msg['dob'].toString());
        This will convert from your inpattern (first argument) to your outpattern (second argument).
        Chris Lang

        Comment


        • #5
          Re:Javascript support

          Also -
          The reason this doesn't work is because Date.parse is a Javascript function and returns a Javascript object. DateUtil.formatDate expects a Java date as it's second parameter, hence you are getting the "can't find method..."
          Chris Lang

          Comment

          Working...
          X