Hello!
I am trying to sort a table by filtering results from a dataset.
I have buttons that I use as tags.
I store a list of tags in my database (comma separated);
e.g.: "tags": "abc,def,ghi,"
When I do the following, it shows me the corresponding row:
$w("#dynamicDataset").setFilter(wixData.filter().hasAll("tags", ["abc,def,ghi,"]));
But when I try to list only some of the words, I get nothing:
$w("#dynamicDataset").setFilter(wixData.filter().hasAll("tags", ["abc","ghi"]));
Any advice or suggestions will be greatly appreciated!
Thank You in advance.
Hey, were you able to resolve this issue?
Hi Anastasiia!
Please share a link to your site so one of us (Wix Team) can inspect it and provide you with a solution.
Doron. :)
Doron,
Thank you for your answer!
I tried to use "hasSome()", it does not work as well.
I have read the article several times, and it does not make any sense why hasAll() does not work. I have tried using arrays, and strings, and nothing shows up.
You suggested to store tags as strings, but I can pass only one string to the column in a dataset. And I cannot store arrays in a dataset. (?)
Even if I manually create an array and pass it to hasAll(), it still does not work. I have no idea why. According to the article, it should work, but it does not. So frustrating.
Any thoughts?
Thank You in advance.
Hi!
Try use hasSome( ) instead of hasAll( ).
hasSome will allow you to look for certain tags inside the query.
It should return all the results that has (well..) some of the parameters you sent.
I would also suggest to split the tags to individual strings ("abc","def","ghi") otherwise the whole string ("abc,def,ghi") has to be found in order to get valid results (plus you got an extra space after the last comma and only then you close the quotation).
Try reading into this article as well.
Hope it helps!
Doron. :)