Finally got this to work - code posted below.
import wixData from ‘wix-data’ ;
//Current Category Code 692e8d06-f517-4dfe-88f6-d48c874c43d5
//Commercial Category Code a560d7e6-c6b0-4917-be63-6c86f27fb97f
//Residential Category Code dc9c0977-107a-48a2-94f2-bd325f0133e2
var result;
var resultFiltered;
var projectCode;
var projectRecord;
$w.onReady(
function () {
let result = wixData.query( “Projects2” )
.include( “categoryId” )
.eq( “projectsInclude” , true )
.limit( 30 )
.find()
.then((result) => {
$w( ‘#repeater2’ ).data = result.items;
})
//---------------------------------------------------------------------
$w( “#repeater2” ).onItemReady( ($item, itemData, index) => {
$item( ‘#text36’ ).text = itemData.projectName;
$item( ‘#text38’ ).text = itemData.projectDescription;
$item( ‘#text40’ ).text = itemData.categoryId.categoryName;
$item( ‘#text43’ ).text = itemData._id;
$item( ‘#image5’ ).src = itemData.image1;
});
//---------------------------------------------------------------------
$w( ‘#drpCategory’ ).onChange( ()=>{
let dropdownValue = $w( ‘#drpCategory’ ).value
//---------------------------------------------------------------------
if (dropdownValue === ‘1’ ) {
let result = wixData.query( “Projects2” )
.include( “categoryId” )
.eq( “projectsInclude” , true )
.limit( 30 )
.find()
.then((result) => {
$w( ‘#repeater2’ ).data = result.items;
})
//---------------------------------------------------------------------
$w( “#repeater2” ).onItemReady( ($item, itemData, index) => {
$item( ‘#text36’ ).text = itemData.projectName;
$item( ‘#text38’ ).text = itemData.projectDescription;
$item( ‘#text40’ ).text = itemData.categoryId.categoryName;
$item( ‘#image5’ ).src = itemData.image1;
});
} else {
//---------------------------------------------------------------------
if (dropdownValue === ‘2’ ) {
let result = wixData.query( “Projects2” )
.include( “categoryId” )
.eq( “projectsInclude” , true )
.eq( “categoryId”,“692e8d06-f517-4dfe-88f6-d48c874c43d5” )
.limit( 30 )
.find()
.then((result) => {
$w( ‘#repeater2’ ).data = result.items;
})
//---------------------------------------------------------------------
$w( “#repeater2” ).onItemReady( ($item, itemData, index) => {
$item( ‘#text36’ ).text = itemData.projectName;
$item( ‘#text38’ ).text = itemData.projectDescription;
$item( ‘#text40’ ).text = itemData.categoryId.categoryName;
$item( ‘#image5’ ).src = itemData.image1;
});
} else {
//---------------------------------------------------------------------
if (dropdownValue === ‘3’ ) {
let result = wixData.query( “Projects2” )
.include( “categoryId” )
.eq( “projectsInclude” , true )
.eq( “categoryId”,“a560d7e6-c6b0-4917-be63-6c86f27fb97f” )
.limit( 30 )
.find()
.then((result) => {
$w( ‘#repeater2’ ).data = result.items;
})
//---------------------------------------------------------------------
$w( “#repeater2” ).onItemReady( ($item, itemData, index) => {
$item( ‘#text36’ ).text = itemData.projectName;
$item( ‘#text38’ ).text = itemData.projectDescription;
$item( ‘#text42’ ).text = itemData.categoryId._id; //get rid of this once it is working
$item( ‘#text40’ ).text = itemData.categoryId.categoryName;
$item( ‘#image5’ ).src = itemData.image1;
});
} else {
//---------------------------------------------------------------------
if (dropdownValue === ‘4’ ) {
let result = wixData.query( “Projects2” )
.include( “categoryId” )
.eq( “projectsInclude” , true )
.eq( “categoryId”,“dc9c0977-107a-48a2-94f2-bd325f0133e2” ) //enter correct code for current
.limit( 30 )
.find()
.then((result) => {
$w( ‘#repeater2’ ).data = result.items;
})
//---------------------------------------------------------------------
$w( “#repeater2” ).onItemReady( ($item, itemData, index) => {
$item( ‘#text36’ ).text = itemData.projectName;
$item( ‘#text38’ ).text = itemData.projectDescription;
$item( ‘#text40’ ).text = itemData.categoryId.categoryName;
$item( ‘#image5’ ).src = itemData.image1;
});
//---------------------------------------------------------------------
}}}}})})