Hi, i wrote this code for filter a dataset 2 times, first for the user and the second for the category of a product.
The category filtering work, but the user filter doesn’t work ( the user is not logged in but I created a small list of users invented in a dataset, therefore the id is that of the row of the customer dataset)
How can I solve it?
import wixData from 'wix-data';
import wixUsers from 'wix-users';
let utente;
let categoria;
$w.onReady(function () {
let utilizzatore = wixUsers.currentUser.id;
console.log(utilizzatore)
});
function filtering (category, user) {
user = $w("#dbClienti").getCurrentItem();
console.log(user);
var newFilter = wixData.filter()
newFilter = newFilter.eq('categoria', category);
newFilter = newFilter.eq('cliente', user);
$w('#dbAcquisti').setFilter(newFilter);
console.log(newFilter)
utente = user
categoria = category
}
export function iptDropdown_change(event) {
let adjGenre;
if ($w('#iptDropdown').value !== 'tutti' ) {
adjGenre = $w('#iptDropdown').value;
}
filtering(adjGenre, utente);
}