Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

149
Vistas
Horizontal array not comparing in if statement

I'm having an issue testing a range to see if the contents are blank. It seams like whatever I place in the if statement (entryTons == blankTest) I cannot get a true result. Can you not compare arrays? I have a solid work around but I was curious why this doesn't work. When comparing the arrays in the debug window they look identical Screenshot

function onEdit() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var dataSheet = ss.getSheetByName("Enter Data");
  var entryRange = dataSheet.getRange(4,1,1,11);
  var entryData = entryRange.getValues();
  var entryTons = dataSheet.getRange(4,2,1,10).getValues();

  var defaultDate = "Today's Entry";
  var blankEntry = [[defaultDate,"","","","","","","","","",""]];
  var blankTest = [["","","","","","","","","",""]];

  if (entryData[0][0] == defaultDate ) return;
  else 
  {
    if (entryTons == blankTest) 
    {
      var ui = SpreadsheetApp.getUi();
      ui.alert("Enter Date after ALL tonnages have been entered.");
      entryRange.setValues(blankEntry);
      return;
    }
    else
    {  
      dataSheet.appendRow(entryData[0]);
      entryRange.setValues(blankEntry);
    }
  }
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda