Announcement

Collapse
No announcement yet.

Delete all OBX lines from a specific point

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

  • Delete all OBX lines from a specific point

    Hi All. Hoping this is quick and easy. I have the below code which deletes 6 lines down from a certain starting point. I need to change it to delete ALL lines from that starting point which in this case is the text "PREVIOUS REPORT:" Thanks for the help!

    for (var i = 0; i <= msg.elements('OBX').length()-1; i++) {
    msg.OBX[i]['OBX.1']['OBX.1.1'] = i+1;
    if (msg.OBX[i]['OBX.5']['OBX.5.1'].toString() == "PREVIOUS REPORT:") {
    delete msg.OBX[i];
    delete msg.OBX[i];
    delete msg.OBX[i];
    delete msg.OBX[i];
    delete msg.OBX[i];
    delete msg.OBX[i];
    i-=6;
    }
    }

  • #2
    var i = 0;
    var found = 0;
    for each(wOBX in msg..OBX) {
    if(found != 0) {
    delete msg.OBX[found];
    }
    if (msg.OBX[i]['OBX.5']['OBX.5.1'].toString() == "PREVIOUS REPORT:") {
    found = i + 1;
    }
    i++;
    }

    Comment


    • #3
      I searched the forums...

      http://www.mirthcorp.com/community/f...d.php?t=214728

      Comment

      Working...
      X