I am newest in JS and I can not reuse variable from alasql. when I run my code i have "unidifined"
var dataSource = alasql('SELECT AGENT_NAME, count(*) FROM XLSX("export.xlsx",{headers:true}) GROUP BY AGENT_NAME')
console.log(dataSource)
but when i run
var dataSource = alasql('SELECT AGENT_NAME, count(*) FROM XLSX("export.xlsx",{headers:true}) GROUP BY AGENT_NAME',[],
function (data) { console.log(data)})
everything is fine
Seems like alasql has a callback after database response. Try this.
dataResult will be undefined till the callback is triggered. After that, it will have the value.
If you want to trigger any code after the database callback is done, put it in the callback itself.