No announcement yet.

Moving MSH-7 DateTime to IN1-29 Policy Date

  • Filter
  • Time
  • Show
Clear All
new posts

  • Moving MSH-7 DateTime to IN1-29 Policy Date


    I'm trying to put the value of MSH-7 (Datetime) stamp into the IN1-29 Policy date field. We usually have a paired insurance segments IN1, IN2, IN1, IN2.
    I get all the IN1 fields to populate correctly with the exception of the date move to the IN1-29 field .

    I'm hoping someone can look at my mess (of logic) below and point me in right direction as to what I'm doing wrong. I appreciate any help provided.

    * IN1, IN2 and IN3 Segments
    var inputIN2Index = 0;
    var mshdate;

    for each (seg in msg.children()) {
    * IN1 Segment
    if ( == "IN1") {
    // seg['IN1']['IN1.29']['IN1.29.1'] = msg['MSH']['MSH.7']['MSH7.1'].toString();
    // tmp['IN1']['IN1.29']['IN1.29.1'] = "ROBW";
    // RDW 09/09/19 - Change to put date/time stamp into the IN1.29.1 field per Melodie R. Request.
    //TEMP COMMENT tmp['IN1'][inputIN2Index]['IN1.29']['IN1.29.1'] = msg['MSH']['MSH.7'];

    var today = DateUtil.getDate('yyyyMMdd',DateUtil.formatDate('y yyyMMdd',new java.util.Date())).getTime();
    var messageDateTime = DateUtil.getDate('yyyyMMddHHmm',msg['MSH']['MSH.7']['MSH.7.1'].toString()).getTime();

    seg['IN1']['IN1.29']['IN1.29.1'] = messageDateTime; - All fields below this line work fine. Its only the IN1.29 field I can not get to populate.
    seg['IN1']['IN1.30']['IN1.30.1'] = msg['IN1']['IN1.30']['IN1.30.1'].toString();
    seg['IN1']['IN1.30']['IN1.30.2'] = msg['IN1']['IN1.30']['IN1.30.2'].toString();
    seg['IN1']['IN1.31']['IN1.31.1'] = msg['IN1']['IN1.31']['IN1.31.1'].toString();
    seg['IN1']['IN1.32']['IN1.32.1'] = msg['IN1']['IN1.32']['IN1.32.1'].toString();
    seg['IN1']['IN1.33']['IN1.33.1'] = msg['IN1']['IN1.33']['IN1.33.1'].toString();
    seg['IN1']['IN1.34']['IN1.34.1'] = msg['IN1']['IN1.34']['IN1.34.1'].toString();
    seg['IN1']['IN1.35']['IN1.35.1'] = msg['IN1']['IN1.35']['IN1.35.1'].toString();
    seg['IN1']['IN1.36']['IN1.36.1'] = msg['IN1']['IN1.36']['IN1.36.1'].toString();

  • #2
    What is the format for MSH.7 and what format do you want?


    • #3
      The format of the MSH-7 from our registration system is YYYYMMDDHHHHss .


      • #4
        And what do you want in IN1.29?


        • #5
          Hi Cory,

          Sorry , I should have mentioned that. We just want the date really so YYYYMMDD. I should also mention when I installed my original change back in December timeframe it looked like the code below:

          tmp['IN1'][inputIN2Index]['IN1.29']['IN1.29.1'] = msg['MSH']['MSH.7'];

          It was only one line of code that I added to nested if for the IN1 segment. The problem that we found was the date was then showing in the IN1-29.1 field but every data field from IN1-30 to IN1-44 was then empty. So I was removing PROD data from everything after the IN1.29 field. Thanks for your help.


          • #6
            tmp['IN1'][inputIN2Index]['IN1.29']['IN1.29.1'] = msg['MSH']['MSH.7']['MSH.7.1'].toString().substring(0,8);

            Should work.


            • #7
              Hi Cory,

              That worked great ! I was able to get the end-user to test it and approved that the date worked in their receiving system. I appreciate your help and quick response .

              Rob Werner
              The University of Toledo Medical Center