Hi,
I am currently working on a website and is new to coding. I have looked up how to filter database but it is somehow not working.
Basically, I am trying to filter the ‘#House’ database so that it matches the userID. However, when i try to run it, it shows all of the other houses that is not equal to the userID.
Here is the code i used:
let userID = wixUsers.currentUser.id;
$w(‘#House’).setFilter(wixData.filter().eq(‘HouseOwner_ID’, userID));
Thank you very much for your help!
Hi,
I’m not very practical with WIX, but I’ll give you a couple of suggestions that may help you.
- $w(’ #House ') must be a collection and not a table
- if userID is string, uses ‘contains’ and not ‘eq’
I hope you can help
Hi Claudia,
Thanks for the reply. I have tried out your suggestions but it doesnt seems to work… I suspect that it might have something to do with me connecting the data to a repeater.
Thank you very much for the help!
Hey Claudia,
I lied! I just found out that I named another collection House instead of the actual House collection -.- and it finally works!
Thank you very much!