I am trying to display a reference field from my database as a result on my filtered repeater. I am unsure of how to code the page for this to happen. When testing my code, this is what shows in the developer console:
Loading the code for the SEARCH WITH VIN page. To debug this code, open i5zkm.js in Developer Tools.
Url: https://vpic.nhtsa.dot.gov/api/vehicles/decodevin/19UUA96299A543965/?format=jsonVINModule.jsw
Line 5{...}
SEARCH WITH VIN
Line 14{...}
VINModule.jsw
Line 12
Dataset is now filtered
SEARCH WITH VIN
Line 22
TypeError: Cannot read property 'items' of undefined
This is my page code:
import {getVINInfo} from 'backend/VINModule';
import {wixData} from 'wix-data';
$w.onReady(function () {
//TO DO: Write Your Page Related Code Here:
});
export function button1_click(event, $w) {
//Add your code for this event here:
getVINInfo($w("#vininput").value)
.then(VINInfo => {
console.log(VINInfo)
$w("#results").text = VINInfo.Results[8].Value + " " + VINInfo.Results[5].Value + " " + VINInfo.Results[7].Value;
$w("#dataset1").setFilter(wixData.filter()
.eq("year", VINInfo.Results[8].Value)
.eq("make", VINInfo.Results[5].Value)
.eq("year", VINInfo.Results[7].Value))
.then((results) =>{
console.log("Dataset is now filtered");
$w("#repeater1").data = results.items;
let items = "title"
})
.catch((err) => {
console.log(err);
});
$w("#repeater1").expand();
})
}
Any and all assistance would be greatly appreciated. I look forward to learning so that I may assist others in need in the near future!