I have 2 databases
Arrivals1
Arrivals2
I have 2 similar columns in both databases
FileNumber
FileNumber
I have a dynamic Page connected to Arrivals1 Database and it is displaying the FileNumber from the dynamicDataset into a Repeater.
Now on my Arrivals2 Database I have a column called 'email'
For instance the File Number 1234 is present in both databases but the 'email' of 1234 is only in Arrivals2
How can I display the 'email' from Arrivals2 inside the Repeater on the dynamic Page connected to Arrivals1
I tried this code but to no avail.
import wixData from 'wix-data';
export function dynamicDataset_ready() {
let itemObj = $w("#dynamicDataset").getCurrentItem();
wixData.query("ArrivalsDatabase")
.eq("fileNumber", $w('#file').text)
.find()
.then(res => {
let clientEmail = [{"email": ''}];
clientEmail.push(...res.items.map(mail => {
return {'email': mail.email};
}));
$w("#mail").text = String(clientEmail);
})
}
Hi shan,
How about something like this:
import wixData from 'wix-data'; export function dynamicDataset_ready() { let itemObj = $w("#dynamicDataset").getCurrentItem(); wixData.query("ArrivalsDatabase") // or is it "Arrivals2" ? .eq("fileNumber", itemObj.fileNumber) .find() .then(res => { if (res.totalCount > 0) { $w("#mail").text = res.items[0].email; } }); }
works perfect!
Thanks Ofer