Announcement

Collapse
No announcement yet.

creating ODT segment after ODS segment

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

  • creating ODT segment after ODS segment

    I am trying to execute the code below. I wanting to create just one ODT segment but it is creating two. What change is needed?

    if (obr12.length > 0)
    //createSegmentAfter('ODT', msg['ODS'])
    {
    var ODT1 = <ODT/>;
    ODT1['ODT.1']['ODT.1.1'] = 'MSG';
    ODT1['ODT.2']['ODT.2.1'] = msg['ODT']['ODT.2']['ODT.2.1'] = msg['OBR'][0]['OBR.12']['OBR.12.1'].toString();
    if (NTEseg1 > 0)
    msg.ODS[NTEseg1 - 1] += ODT1;
    else
    msg.ODS[thisODSNum - 1] += ODT1;
    }

    Before

    ORC|Order|3728323879^HNAM_ORDERID|||Ordered||||201 80220162305||||||20180220162411|||Written^Written
    OBR|1|3728323879^HNAM_ORDERID||Regular Diet.^Regular Diet||||||||Contact Bleach^Contact Bleach||||||||||20180220162411||Diets|||1^^0^20180 220162300

    Current Result

    ODS|D||Regular Diet.
    ODT|MSG|Contact Bleach
    ODT||Contact Bleach

    Expected Result

    ODS|D||Regular Diet.
    ODT|MSG|Contact Bleach

  • #2
    I expect that this line
    Code:
    ODT1['ODT.2']['ODT.2.1'] = msg['ODT']['ODT.2']['ODT.2.1'] = msg['OBR'][0]['OBR.12']['OBR.12.1'].toString();
    should say this
    Code:
    ODT1['ODT.2']['ODT.2.1']  = msg['OBR'][0]['OBR.12']['OBR.12.1'].toString();

    Comment


    • #3
      Thanks. It worked.

      Comment

      Working...
      X