Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

180
Views
Cleaned nodejs SQL Server query result content shown as undefined

When I try to clean the result of my query and output it in console it returns "undefined" for both the value tag and the options content. I know I am using the correct column names for this. I am using the nodejs mssql package for this. Any idea on why this is happening and how to fix it?

querymodule

const query = () =>{
    var output =``
    sql.connect(config).then(pool => {
        // Query
        
        return pool.request()
            .query('SELECT Pdf_Filename, SKU FROM RDCProductLabels WHERE PDF_Filename is not null Order by SKU')
    }).then(result => {
        for(data in result){
            output +=`
                        <option value="${data.PDF_Filename}">
                            ${data.SKU}
                        </option>
                     `
        }

        console.log(output)
        
    }).catch(err => {
       console.log(`an error occurred - ${err}`)
    });
}

generated html

  <option value="undefined">
      undefined
  </option>

  <option value="undefined">
      undefined
  </option>

  <option value="undefined">
      undefined
  </option>

  <option value="undefined">
      undefined
  </option>

  <option value="undefined">
      undefined
  </option>                       
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!