Announcement

Collapse
No announcement yet.

Javascript help

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

  • Javascript help

    Please let me know which type and version of javascript is used in building mappings in the transformer. Also it would be great if you could let me know a link to a reference for the javascript used in Mirth.

    I am currently trying to pull in the current date and time for the MSH.7 segment and not having much luck. Any examples?

    Thanks for any help!

  • #2
    Re: Javascript help

    hello,

    in the "edit transformer" window you must do the follwing:
    - klick "add a new step"
    - then copy and paste a HL7_Message in the HL7-Message Template window at the right side
    - then in the HL7-Tree View you cann expand the tree until you have found the value you are looking for and then
    drag and drop the VALUE in the Mapping window
    - that works for me

    Comment


    • #3
      Re: Javascript help

      I wish it were that easy. What I get when I do that is the same value all the time. I came up with a mapping. It may not be the best way but it works. Here is what I am using:

      td = new Date();
      var theyr = td.getFullYear().toString();

      var themon = String(td.getMonth()+1);
      if (themon.length == 1){themon = '0' + themon};

      var theday = td.getDate().toString();
      if (theday.length == 1){theday = '0' + theday};

      var thehr = td.getHours().toString();
      if (thehr.length == 1){thehr = '0' + thehr};

      var themin = td.getMinutes().toString();
      if (themin.length == 1){themin = '0' + themin};

      var thesec = td.getSeconds().toString();
      if (thesec.length == 1){thesec = '0' + thesec};

      tmp['MSH']['MSH.7']['TS.1']=theyr+themon+theday+thehr+themin+thesec;

      Comment

      Working...
      X