@jimhill21 said in Node.js Mysql with Query from Variable how to get it working?:
@tecnewb said in Node.js Mysql with Query from Variable how to get it working?:
await(new Promise((resolve, reject) => {
I have found a solution that can keep the BAS variables in your extra files. Simply set a initial value to the BAS variables in the "Current" file before they are used in the extra files. Example: in your current file near the top add [[RESULTS]] = ''.
Once you set the BAS variable to any value in the "Current" file, you're able to get and set it in the extra files.
@Support knows about this problem and will fix it in the next version. By setting any value in the "current" file for the BAS variable, you will get a bug in the "Run" mode:
current file
[[RESULT]] = "hello"
await require("../bas.js")();
bas.js
module.exports = async function () {
await BAS_API("VAR_RESULT = thread_number()");
return console.log([[RESULT]])
}
result:
0_1571668654306_540f3bee-9b49-4fa7-bf94-1b042fd98b71-изображение.png
Test script