title: Spreadsheet app script to check two conditions not working
body: <p>I want to write a Spreadsheet Appscript to check for two conditions, namely Country and Status, and create a new sheet where these rows will be added.
  The code I've written is as follows :-</p>
  
  <pre><code>function Selection() {
  
  
  
  var sheet = SpreadsheetApp.getActiveSheet();
  var data = sheet.getActiveRange().getValues();
  
  var ui = SpreadsheetApp.getUi();
  var response = ui.prompt('Enter Country:', ui.ButtonSet.OK);
  var country = response.getResponseText();
  
  var arr = new Array;
  
  for( var i in data )
    {
       if(data[i][7] == country)
  
      {
         if(data[i][28] = "Accepted")
  
          {
            arr.push(data[i])
          }
  
      }  
  
    }
  
  var newsheet = sheet.insertSheet();
  
  newsheet.setName("New");
  
  New.getRange(2,1,arr.length,data[i].length).setValues(arr);
  
  }
  </code></pre>
  
  <p>The code is not working for some reason. Any help will be appreciated.</p>