I have a collection (RecipeIngredient) that has referenced fields (recipe, ingredient, form and unit). I want to display a list of ingredients for a recipe in a repeater. Firstly, the dataset connected to the repeater (for recipeIngredients) does not show the fields from the referenced fields as available, they are all greyed out so using the dataset directly is out of question. I am trying to populate the repeater in the onReady function using a query. I can get hold of the recipe object on the page but trying to add that as a parameter to the query eq condition is proving to be a challenge. My query looks like
wixData.query(“TBL_RECIPE_INGREDIENTS”)
.ascending(“displayOrder”)
.eq(“recipe”, $w(‘#dynamicDataset’).getCurrentItem())
.include(“recipe”)
.include(“ingredient”)
.include(“ingredientForm”)
.include(“ingredientUnit”)
.find()
.then((results) => {
console.log("Results " + JSON.stringify(results));
$w(‘#repeater1’).data = results.items;
})
.catch((err) => {
let errorMsg = err;
console.log("Error " + errorMsg);
});
I have tried passing various properties of the recipe object as parameters but it just does not stick. What am I doing wrong. Any advice is highly appreciated.