I have a repeater that I want to fill with data using a simple query. The correct number of records show so I know it is pulling the data. In addition, I hard coded the primary key and all the data shows properly in the console. I am following this:
I have triple checked the names of the fields as well as the names of the text items and both come up in the autofill feature. I was hoping another pair of eyes would see what I missed. Thank you.
let DATABASE = "PaymentSchedule";
let FIELD1 = ; // <-- fill in here DATABASE-FIELD-ID-1 !
let VALUE1 = ; // <-- fill in here your wished value for field-1...
//-----------------------
let FIELD2 = ; // <-- fill in here DATABASE-FIELD-ID-2 if existing !
let VALUE2 = ; // <-- fill in here your wished value for field-2 if existing...
//-----------------------
let FIELD3 = ; // <-- fill in here DATABASE-FIELD-ID-3 if existing !
let VALUE3 = ; // <-- fill in here your wished value for field-3 if existing...
//-----------------------
$w.onReady(async function() {console.log("Page is ready!");
let resData = await get_specificData(DATABASE, FIELD1, VALUE1);
// or...
let resData = await get_specificData(DATABASE, FIELD1, VALUE1, FIELD2, VALUE2);
// or..
let resData = await get_specificData(DATABASE, FIELD1, VALUE1, FIELD2, VALUE2, FIELD3, VALUE3);
console.log("RESULT-DATA: ", resData);
});
// This function can be used to do custom FILTRATION... (max. 3-fields / 3-values)...
async function get_specificData(DATABASE, FIELD1, VALUE1, FIELD2, VALUE2, FIELD3, VALUE3){
let query = wixData.query(DATABASE);
if(FIELD1) query = query.eq(FIELD1, VALUE1)
if(FIELD2) query = query.eq(FIELD2, VALUE2)
if(FIELD3) query = query.eq(FIELD3, VALUE3)
return query.find()
.then((res)=>{return (res.items);}).catch((err)=>{console.log(err);});
}