You can approach this in several ways. Since I'm not 100% certain that there will always be an IN2 or ZIN segment the approach below gets rid of all of the IN1 groups and then only adds back the ones that do not have a date in IN1-13.
// Gather all of the segments before the first IN1 segment
var messageBeforeIN1 = source.getNode('MSH[group=!IN1]');
var in1NewGroup = '';
// create an array of IN1 groups
var in1Groups = source.getAllNodes('IN1[group=!IN1]');
for (var i=0 ; i < in1Groups.length ; i++) {
// create a variable of the specifi instance of IN1 group that we are going to analyze
var in1Segments = qie.parseHL7String(in1Groups[i]);
// if the date in IN1-13 is empty then we can add this group back to our message
if (StringUtils.isEmpty(in1Segments.getNode('IN1-13'))) {
in1NewGroup = in1NewGroup + in1Segments.getNode('/') + '\r';
}
}
// Replace the entire message with our new composed message of just the IN1 groups that have no date
message.setNode('/', messageBeforeIN1 + in1NewGroup);