I am trying to access variable processStatus while using nodejs
JSON.stringify(result[0], null, 4)
gives the following:
{
"processingResult": "[{\"processStatus\": \"Successfully insert record\"}]"
}
I have tried
if (result[0].processingResult[0].processStatus.indexOf('Successfully insert record') === -1)
but gives Error TypeError: Cannot read property '0' of undefined
this is a snippet of my code
const result = await db.executeStoredProc(...);
logger.info('Result[0]: ' + JSON.stringify(result[0], null, 4)); //as above result
if (result && result.length) {
if (result[0].processingResult[0].processStatus.indexOf('Successfully insert record') === -1)
throw new Error(`Error: ${result}`);
}
Thanks in advance.