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

145
Vistas
Async Await Returns Empty Array in Console

Going in circles here and hope someone can help guide me. Trying to build an array from a query to later use for a grid table. However, something I am unfamiliar with happens when I try to console.log using the array after the awaited section.

console.log(strandTable.length) comes back as 0. console.log(strandTable) comes back with some empty square brackets [], but when I expand it shows all my data. So all the data is first in a NULL section.

when I try console.log(strandTable[0]) I get an undefined.

    async function viewStrandInfo() {

      var strandTable = []

      let cableObjectId = view.popup.selectedFeature.attributes.OBJECTID

      let bufferQuery = {
        outFields: ["OBJECTID", "BUFFERTUBENUMBER", "BUFFERTUBECOLOR", "BUFFERTUBENAME"],
        relationshipId: fibrecableLayer.relationships[0].id,
        objectIds: cableObjectId
      }

      let buffers = await fibrecableLayer.queryRelatedFeatures(bufferQuery)

      await buffers[cableObjectId].features.forEach((buffer) => {
        let bufferObjectId = buffer.attributes.OBJECTID

        let strandQuery = {
          outFields: ["OBJECTID", "FIBERNUMBER", "FIBERCOLOR", "ADMINLABEL", "STATUS", "OWNER", "ADMINISTRATOR", "HOT_CIRCUIT_ID", "COMMENTS", "RESERVEDFOR"],
          relationshipId: buffTable.relationships[0].id,
          objectIds: bufferObjectId
        }

        buffTable.queryRelatedFeatures(strandQuery).then((result) => {
          result[bufferObjectId].features.forEach((strand) => {
            strandTable[strand.attributes.FIBERNUMBER] = {
              strand: strand.attributes.FIBERNUMBER,
              buffer: buffer.attributes.BUFFERTUBENUMBER,
              adminlabel: strand.attributes.ADMINLABEL,
              status: strand.attributes.STATUS,
              owner: strand.attributes.OWNER,
              admin: strand.attributes.ADMINISTRATOR,
              cctid: strand.attributes.HOT_CIRCUIT_ID,
              comments: strand.attributes.COMMENTS,
              reservedfor: strand.attributes.RESERVEDFOR    
            }
          })
        })
      })

      console.log(strandTable.length)
      console.log(strandTable)

    };
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