hi
i have this code:
queryAdmin("reg", "branch", 100)
.then(res => {
// for (i=0;i<days;i++){
for (j = 0; j < res.length; j++) {
querymoadon(res.items[j].name, res.items[j].branch, startdate, enddate)
.then(results2 => {
total = total + results2.length;
$w("#textBox1").value = $w("#textBox1").value + results2.items[0].reg + ";" + results2.items[0].branch + ";" + results2.length + "\n";
($w('#html1').postMessage($w("#textBox1").value));
});
}
})
.then(()=>{
$w("#html1").show();
});
}
async function querymoadon(reg, branch, startdate, enddate) {
const results = await wixData.query("moadon")
.limit(1000)
.eq("reg", reg)
.eq("branch", branch)
.le("_updatedDate", enddate)
.ge("_updatedDate", startdate)
.find();
return results;
}
async function queryAdmin(collection, asc, limit) {
const res = await wixData.query(collection)
// Get the max possible results from the query
.limit(limit)
.ascending(asc)
.find();
return res;
}
html1 is hidden by default and i want to show it only when all the results are shown !!
so i have to wait until all query are done and only then show the html component.
how can this be done?