Well, thanks for the direction I did some research and found the issue with our SQL requiring a little different formatting to connect, this may help others.
const sql = require("mssql");
const config = {
server: "els********.*********.com",
port: 1433,
authentication: {
options : {
type: "default",
userName:"ELSReadOnly",
password:"****************************"
}
},
options: {
database: "ELSReadOnly",
enableArithAbort: true,
trustServerCertificate: true
}
}
The current issue is trying to see how database select differed from straight select on SQL.
SELECT AccountId, AccountCreatedDatetime, AccountName, LastCalculatedBalance, AccountDescription, CanOnlyCredit, CurrencyCode, AccountStatusId, AccountUseId, AccountTypeId, BrokerId, ReplicationStatusID, ReplicationStatusDateTime
FROM ELSReadOnly.dbo.Account;
Now we are down to this issue, any guidance to make this work and be simpler would be great.
ReferenceError: Account is not defined
at Object.beforeRender (evaluate-user-script.js:25:34)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
below is the function in the jsreport script
async function beforeRender(req, res) {
await sql.connect(config);
const sqlReq = new sql.Request();
const recordset = await sqlReq.query('select * from ELSReadOnly.dbo.Account')
Object.assign(req.data, { Account: { recordset } })
const person=req.data.Account.recordset;
req.data.ELSReadOnly.Account=Account;
console.log(ELSReadOnly.dbo.Account);
}
sql.close()