Title | Image |
---|---|
Book-1 | |
Book-2 | |
Book-3 | |
Book-4 |
Books
Collection -
Reference-Field
Column-Name: Author
ID: ---> "author"
Title | Author-Firstname | Author-Lastname | Authors-Birthday | Author-Pic |
---|---|---|---|---|
Author-4 | Charles | Dickens | 1812 | |
Author-3 | Ernest | Hemingway | 1899 | |
Author-2 | Johan-Wolgang | Von Goethe | 1782 | |
Author-1 | Friedrich | Schiller | 1759 |




CODE

import wixData from 'wix-data';
$w.onReady(function () { });
export function BTN_click(event) { start_Function() }
function start_Function() {
wixData.query("Books").include("author").find()
.then( (results) => {
if(results.items.length > 0) {
let books = results.items;
let firstBook = books[0];
let firstAuthor = firstBook.author;
console.log(books)
console.log(firstBook)
let output1 = [], output2 = []
for (var i = 1; i < results.items.length; i++) {
output1.push(books[i].author.authorFirstname)
output2.push(books[i].author.authorLastname)
}
console.log(output1, output2)
$w('#TXToutput1').text=output1.toString()
$w('#TXToutput2').text=output2.toString()
} else { }
} )
}