title: issue in writing multiple segments in the database through Mirth
body: <p>I have a problem here , I have a EDI file where there is a segment called CLP where there will be the claim details and after it the segments that defines that claim</p>
  
  <p>I want to write the first instance of the claim to go through the repeating segments after it and write the mapped data against it and then once the next CLP segment comes the outer loop should increment and the inner loop should break .</p>
  
  <p>But in the present code my inner loop doesn't breaks,for the first instance of the CLP it reads all the repeating segments till the end of the file .</p>
  
  <pre><code>for (var i = 0,len=msg.CLP.length();i&lt;len;i++) 
      var claim_id = msg['CLP'][i]['CLP.01']['CLP.01.1'].toString() 
  for (var j = 0;j&lt;=len;j++) 
  { 
      if(msg.name() == "CLP") 
      {
          j = 0; break ;
      } 
      var Record_qualifier = msg['REF'][j]['REF.01']['REF.01.1'].toString() 
      var Medical_record_number = msg['REF'][j]['REF.02']['REF.02.1'].toString() 
      var stored_proc = "CALL 835_Claim_Medical_record_No ('" + claim_id + "','"+ Record_qualifier +      "','" + Medical_record_number + "')"; 
      var update= dbConn.executeUpdate (stored_proc); 
  </code></pre>