Skip to content

List pages that have the same value in a field than the current one, i.e. to find recipes that share ingredients

Contributed via Discord

List pages that share a meta data value with the current page

Basic

If you have a single value:

LIST
FROM "10 Example Data/food"
WHERE recipe-type = this.recipe-type

If you have a multi value field (list):

TABLE ings AS "shared ingredient"
FROM "10 Example Data/food"
WHERE ingredients
FLATTEN ingredients as ings
WHERE contains(this.ingredients, ings) AND file.name != this.file.name

Variants

Show file only once as result

TABLE rows.ings AS "shared ingredient"
FROM "10 Example Data/food"
WHERE ingredients
FLATTEN ingredients as ings
WHERE contains(this.ingredients, ings) AND file.name != this.file.name
GROUP BY file.link

Group by ingredient instead of file/recipe

TABLE WITHOUT ID ings AS "shared ingredient", rows.file.link AS "recipes"
FROM "10 Example Data/food"
WHERE ingredients
FLATTEN ingredients as ings
WHERE contains(this.ingredients, ings) AND file.name != this.file.name
GROUP BY ings

Calculate count of meta data value matches

TABLE WITHOUT ID ings AS "shared ingredient", count AS "recipe count", rows.file.link AS "recipes"
FROM "10 Example Data/food"
WHERE ingredients
FLATTEN ingredients as ings
WHERE contains(this.ingredients, ings) AND file.name != this.file.name
GROUP BY ings
FLATTEN length(rows.file.link) as count