I have read several pages and it seemed like an easy task yet I am stuck on the first step. The whole process is as follows:
-
Extract all the ‘Date’(date) fields in the ‘WeeklyBillingDates’ collection and add them to an array called ‘dates’
-
Step through the ‘dates’ array and create a record for each date in the ‘Payments’ collection to be used for billing purposes.
I used the code below to create the array. There are 5 records in the array. When I run the code and try to log one of the values to the console, I get the value as 'undefined, even though I can get a record count of 5.
wixData.query("WeeklyBillingDates")
//.eq("inactive", false)
.limit(50)
.find()
.then((results) => {
const datesArray = results.items;
console.log("date - " + datesArray[0].Date);
console.log(" datecount - " + datesArray.length.toString());
})
The result in the console is:
date - undefined
datecount - 5
The collection:
Question - Can anyone see why I can’t display a date in the console? Thank you.