title: how to append to an array in groovy
body: <p>I'm having a little issue with arrays in groovy. I am performing a data driven test where I am using a CSV and I am iterating through groovy script steps. What I am trying to do is for each iteration of my soap request, i should receive two flight ids. I want to place each set of the two flights ids in an array, so the array should just keep adding flight ids in the array:</p>
  
  <p>Example:</p>
  
  <pre><code>After Iteration 1: [[123, 321]]
  After Iteration 2: [[123.321. 454, 345]]
  </code></pre>
  
  <p>The problem I am having is that it is not adding into the array but instead replacing the values already in the array. So it looks like below:</p>
  
  <pre><code>After Iteration 1: [[123, 321]]
  After Iteration 2: [[454, 345]] 
  </code></pre>
  
  <p>How can I append the flightids in the array?</p>
  
  <p>Below is the code:</p>
  
  <pre><code>import groovy.xml.XmlUtil
  def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
  def response = context.expand( '${SOAP Request#Response}'  )
  def parsedxml = new XmlSlurper().parseText(response)
  
  
  def flights = parsedxml.'**'.findAll { it.name() == 'FlightId'}[[0],[1]]
  
  
  def flightsarray = [];
  
  flightsarray.push(flights)
  
  context.setProperty('flights', flights)
  context.setProperty('flightsarray', flightsarray)
  
  log.error flightsarray.toString()
  </code></pre>
  
  <p>FYI I tried replacing     <code>flightsarray.push(flights)</code> with <code>flightsarray &lt;&lt; flights</code> but it does the same thing. </p>