Printing same value if we call function inside the loop. Can you help me to resolve this issue. pls check the image
It outputs this:
"isinRes 8 SA0007879782" "isinRes 8 SA0007879782" "isinRes 8 SA0007879782" "isinRes 8 SA0007879782" "isinRes 8 SA0007879782" "isinRes 8 SA0007879782"
check below code and help me to fix this :) Issue- Postman image
for (var i = 0; i < rowCount; i++) {
var dat = bodyData.DAT.SYMS[i];
var dataArr = dat.split('|');
//Verify symbol with seach key
var symbolRes = dataArr[1];
pm.test("Row : " + i + " - " + dataArr[1] + " : Verify symbol name with seach key", function () {
pm.expect(symbolRes).is.to.includes(sk);
});
//Verfy Exchange with input exchange value
var exgRes = dataArr[0];
pm.test("Row : " + i + " - " + dataArr[0] + " : Verify symbol name with req exchange name", function () {
pm.expect(exg).is.to.equals(exgRes);
});
//Getting Symbol details from DB API
//var insTypeDB;
//var sectorDB;
var isinDB;
//var isinRes = dataArr[6];
pm.sendRequest("http://192.168.xx.xxx:8080/ords/unidata/symbol/symbol/" + dataArr[1], function (err, response) {
var resBoday = response.json()
//insTypeDB = resBoday.items[0].instrument_type_id;
//sectorDB = resBoday.items[0].sector_id;
isinDB = resBoday.items[0].isin_code;
////var intInsTypeDB = parseInt(insTypeDB);
//console.log("insTypeDB " + insTypeDB);
//console.log("sectorDB " + sectorDB);
console.log("isinDB "+i+" "+isinDB);
//Verify ISIN code with DB API
pm.test("Row : " + i + " - " + dataArr[1] + " : Verify ISIN code with DB", function () {
var isinRes = dataArr[6];
console.log("isinRes "+ i +" "+ isinRes);
pm.expect(isinDB).is.to.equals(isinRes);
});
});
}