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

124
Vistas
Reading firebase child and grandchild snapshots-Web

trying to read in the following branch

 "finance": {
    "lvAN928K9qXJ5RGiRBUrb6seByM2": {
      "-N6XXgy0COp30w52pxzZ": {
        "link": "https://firebasestorage.googleapis.com/v0/b/myhouse-4ba96.appspot.com"
      },
      "-N6XXh2rkW0jT7MNpO2-": {
        "link": "https://firebasestorage.googleapis.com/v0/b/myhouse-4ba96.appspot.com"
      },
      "email": "app@email.com",
      "houseContractor": "General construction ",
      "houseCost": "2400000",
      "income": "1200000",
      "institution": "Commercial Banks",
      "nic": "123456789",
      "permit": "Yes"

I need to access from email to permit as well as the 2 link under the 2 keys. My code reads the data but the output is incorrect. All data goes in a table row.

Code i tried

try
{
    const dbref = ref(db);
    get(child(dbref,"finance")).then((snapshot)=>
    {
    var client=[];
    snapshot.forEach(childSnapshot =>{
        childSnapshot.forEach((grandchildSnapshot) =>{  
            if(grandchildSnapshot.hasChild("link"))
            {
                let item2=childSnapshot.val();
                let item=grandchildSnapshot.child("link").val()
                client.push(item);
                client.push(item2)
            }
            
        });
        
    });
    AddAllItemsToTable(client);


function AddAllItemsToTable(quotation) {
    tbody.innerHTML = "";
    quotation.forEach(element => {
        addItem(element.nic,element.email,element.permit, element.institution, element.income, element.houseContractor, element.houseCost,element.link,element.link);
    });

The output is produces

website

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