Currently I am trying to go through a database of names, then using those names, I query another database for any resulting rows that have the ‘name’ column entry the same as the first database’s name and insert it into a textbox:
let numnames = $w(‘#datasetelem’).getTotalCount();
console.log(numnames);
$w(‘#textBox1’).value = “Name\n”;
$w(‘#textBox3’).value = “Aquifier\n”;
for ( var i = 0; i < numnames; i++) {
$w(‘#datasetelem’).getItems(i,1)
.then( (result) => {
console.log(result['items'][0]['benzene']);
var elemname = result[‘items’][0][‘benzene’];
$w(‘#textBox1’).value += elemname + “\n”;
if ($w(‘#radioGroup3’).value === “No”) {
$w(‘#textBox4’).value += “-\n”;
} **else** {
wixData.query("NaturalTest")
.eq("name", elemname)
.find()
.then( (results) => {
f++;
console.log(f);
let firstItem = results.items[0];
let soilthing = firstItem[‘aquifierFine’];
$w(‘#textBox3’).value += soilthing + ‘\n’;
} )
. catch ( (err) => {
$w('#textBox3').value += '-' + '\n';
} );
}
} );
}
The only part that does not work is that sometimes the textbox value does not display some of the results. I logged it in the console and it works fine. But in the label, some entries are not displayed.