Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
None
-
None
-
Windows and Linux : 10.6.5 / 10.6.7
nodejs driver 3.0.2
Description
I do a select statement and loop through it, there always seems to be an extra blank row. So I have to check for the "key" to see if it is undefined, so my loop ignores the last row.
I hope I have my code right and you don't mean to have a blank row at the bottom.
dlog is a console.log thingy that runs (!production)
|
const resultEmailAttachments = await mdbConn.query(
|
"SELECT * FROM EM_EmailAttachments WHERE EmailID = ? ;", [data.EmailId] |
);
|
|
// Build the array of attachments. |
const aAttachList = [];
|
const emailAttchData = resultEmailAttachments;
|
dlog("AttchData.length", emailAttchData.length); |
if (emailAttchData.length > 0) { |
for (var k in emailAttchData) { |
*{color:red} if (emailAttchData[k].AttachmentFileName) {{color}* |
let aFilePath = path.normalize(emailAttchData[k].AttachmentFileName);
|
dlog("emailAttchData.aFilePath", aFilePath); |
let aFileName = path.basename(aFilePath);
|
dlog("emailAttchData.aFileName", aFileName); |
let aAttachment = emailAttchData[k].Attachment;
|
aAttachList.push({
|
filename: aFileName,
|
content: aAttachment,
|
encoding: "base64", |
});
|
}
|
} dlog("Trace", "leave loop"); |
}
|
}
|