I am having a simple code, but having no clue of why the for loop is running once. with the data I am having, it should run 7 times (imax = 7). The code in yellow, never run
Any idea of why the for loop stop running.
$w.onReady(async function () {
let s2 = wixData.query("integrityBooking")
.isEmpty("execTime")
.find()
.then(async (results) => {
let resCount = results.totalCount;
if (resCount > 0) {
let itgTbl = await results.items;
let imax = itgTbl[0].bookObj.rowCount;
console.log("#itération= " + imax);
for (let index = 0; index < imax; index++) {
let exec = await itgTbl[index].execTime;
iRow = await itgTbl[index].iObj;
bRow = await itgTbl[index].bObj;
bookRow = await itgTbl[index].bookObj.rows;
let tblRow = {
"fromDt": bookRow[index].fromDt,
"toDt": bookRow[index].toDt,
"chalet": bookRow[index].chalet,
"loginEmail": bookRow[index].loginEmail
}
tbl[index] = await tblRow;
await $w('#table1').updateRow(index, tblRow);
}
await console.log("tbl row count = " + tbl.length);
}
})
.catch((err) => { return (err) });
});