Error: Included category field is not a reference field.

My Idea is very simple. I’m displaying a list of tutors using repeaters on my dynamic page. What I need is a filter, when user select in drop down button (field key=catdropdown) which category they are looking for, tutor’s associated with only those categories list on page.
What I have Done.

  1. Created a database(field key=tutordataset) for tutors which connects to dynamic page.
  2. Created a database for categories which include names of six categories such as arts, academics etc…
  3. In my tutor database added a column with field of reference(field key=catref), which refer to my category database.

Here is my code:

import wixData from ‘wix-data’;

$w.onReady ( function () {

}) ;
export function catdropdown_change(event) {
let searchcat = $w(“#catdropdown”).value;
$w(“#tutordataset”).setFilter(wixData.filter().contains(“catref”, searchcat));
}

Now even after writing this code,
I’m getting error in preview mode like : Included category field is not a reference field.
And when i change drop down menu nothing displays on the page. Need help with this.

Hey Asif,

Try to use eq() method instead of contains().
The reason is that with properties that are References, contains() matches by the ID of the referenced item as a String.

https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html#contains

Best of luck,
Sapir