Ok, thank you I think I have managed to do that. Just one more thing that has just cropped up. The dataset has a filter set to “is Scheduled” so it does not display past events. Can you point me in the right direction to add that into the code please?
import wixData from 'wix-data';
$w.onReady(function() {
wixData.query("Events/Events")
.ascending("start")
.limit(8)
.find()
.then((results) => {
if (results.totalCount > 0) {
$w("#upcomingrepeater").data = results.items;
}
})
.catch((error) => {
console.log("Error:", error.message);
});
//here you are applying the returned data from above to the repeater elements
$w("#upcomingrepeater").onItemReady(($item, itemData, index) => {
//use a switch statement to manage your cases and adj the text
switch(itemData.registrationStatus) {
case 'OPEN_TICKETS':
itemData.registrationStatus = 'BOOKINGS OPEN'
break;
case 'CLOSED_MANUALLY':
itemData.registrationStatus = 'BOOKINGS CLOSED'
break;
case 'CLOSED':
itemData.registrationStatus = 'BOOKINGS CLOSED'
break;
case 'OPEN_EXTERNAL':
itemData.registrationStatus = ''
break;
default:
itemData.registrationStatus = 'default status'
}
//here you are manually pointing the repeater elements to each value you want
$item("#bookingstatustext").text = itemData.registrationStatus;
});
});