Ok, I’ve got it working, however when adding multiple filters they only set as AND (they are all active). (Vitamins for Vision AND Bone Health AND Prostate). There is no way, without coding it, for you to set the filters for the master dataset as OR (Vitamins for Vision OR Bone Health OR Prostate).
Is there a way to filter a master dataset via code so I can use OR? Below works, but only if I go in and set in the database the category field as just text, NOT REFERENCED.
export function table2_cellSelect(event, $w) {
//This changes the TABLE1 products from the category listed in table2
let cellData2 = event.cellData;
$w(“#dataset1”).setFilter(wixData.filter()
.contains(“category”, cellData2));
UPDATE: I’ve written the code below that uses rowSelect to get the ID from the table that is clickable. If I use the _id (its the very long A239487324-23489723-11ve4F id CODE) of the REFERENCED dataset, then I can filter it that way. So, a visitor to the website sees a list of CATEGORIES of vitamins (Eye Health, Brain Health) on the left side. This is table2. They click on a Category (Eye Health), and then this code reads the row data into rowData. Since Wix can’t currently set the filter on a dataset field that is defined as reference (not sure why???), this comes in a close second as it uses the _id of the table from the reference dataset.
Hacked…yes. But works. Make sure the table is set to select ROW and not CELL. I still can not do multiple filters set as OR, but thinking on how to do this as a QUERY.
Example:
export function table2_rowSelect(event, $w) {
let rowData = event.rowData; // gets row DATA when you click on the table that has the REFERENCED
dataset list. specifically wanting _id, to use as FILTER variable. see next
$w(“#dataset1”).setFilter(wixData.filter() //uses _id, supplement name as CODE, to filter table
.contains(“category”, rowData._id)); 12