I have this query
getAnalysisDetailed: function (req, res, next) {
var config = require('.././database/config');
sql.connect(config).then(function() {
var articulos = null;
var request = new sql.Request();
request.query("SELECT TOP 10 SI_Id_Inventario, SI_Articulo, SI_UM, SI_Ubicacion FROM SI_Inventario_Teorico_QAD").then(function(err, rows, recordset) {
articulos = rows || [];
console.log('Recordset: ' + recordset);
console.log('Affected: ' + request.rowsAffected);
}).catch(function(err) {
console.log('Request error: ' + err);
});
}).catch(function(err) {
if (err) {
console.log('SQL Connection Error: ' + err);
}
});
sql.close();
// send records as a response
res.render('menu/analisisDetallado', { ListArticulos: articulos });
}
and I need to add what it brings to a table
div(class="container aDetallado")
div(class="row center span10")
table(id="test-table" class="table table-striped table-hover table-condensed")
thead
tr
th='ID'
th='Articulo'
th='Um'
th='#Ubic'
tbody
each Articulos in ListArticulos
tr
td= Articulos.SI_Id_Inventario
td= Articulos.SI_Articulo
td= Articulos.SI_UM
td= Articulos.SI_Ubicacion
and I get the following error
TypeError: D: \ Physical Inventory Project Soc \ InventoryF \ views \ menu \ detailed analysis.jade: 59 57 | th = 'Ubic'
58 | tbody59 | each Articles in ListArticles 60 | tr 61 | td = Articles.SI_Id_Inventario 62 | td = Articles.SI_Articulo
Can not read property 'length' of undefined