Hi there
I was trying with this for hours now, and can’t figure out why I’m receiving this error!
Here’s the code:
export function getCalculatedRelatedItems(discountedPrice, name, itemsToGet) {
let maxPrice = (Number(discountedPrice) * 20 / 100) + Number(discountedPrice);
let minPrice = Number(discountedPrice) - (Number(discountedPrice) * 20 / 100);
return wixData.query('Stores/Products').contains('name', name).le('discountedPrice', maxPrice).and(wixData.query('Stores/Products').contains('name', name).ge('discountedPrice', minPrice)).limit(itemsToGet).find({suppressAuth: true}).then((result) => {
if (result.length > 0) {
return result.items;
} else {
return [];
}
}).catch(err => {
console.error(err);
return [];
})
}
The error that I’m getting from the catch method:
Object = {
name: "Error",
errorGroup: "User",
code: "WD_VALIDATION_ERROR"
}
Here’s the error that I get when I remove the catch method:
Object = {
message: "Unknown token discountedPrice -> Map($lte -> 600)",
details: {} // Empty Object
}
Any ideas what’s the reason behind this? Any help is really appreciated!
Thanks in advance.
Ahmad