Creating Index of Recipes with Dataview

What I’m trying to do

I’m trying to create a Dataview query that produces index of recipes sorted by the YAML property “meal” (which contains values like “bread”, “breakfast” or “dessert”.

I’m trying to do something like u/mnvwvnm does here:

However, first column of mnvwvnm’s table is based on tags, and (as I said) I want one based on the YAML field “meal”.

Things I have tried

I can almost get what I want with this query:

TABLE WITHOUT ID
meal as "Meal",
file.link AS "Recipe"
From [[Recipes]]
SORT meal asc

However, this query lists the meal in every row, whereas I’d like it if the meal (e.g. “bread”) appeared once, like the tags do in the index mnvwvnm creates.

I’ve tried using GROUP BY, like this:

TABLE WITHOUT ID
meal as "Meal",
file.link AS "Recipe"
From [[Recipes]]
GROUP BY meal

But all that does is list my five (current) meal types, and with each one the “Recipe” column is just “-”.

Grateful for any help anyone can give.

1 Like

Something like this?

TABLE WITHOUT ID file.link AS "Recipe", drinks, dessert
Property = value and Property = value or Property = value
SORT Property asc

Eg, replace Property with your custom field, like Drinks and value with water

Thanks for the reply, unfortunately I don’t think that’s quite what I’m looking for.

All my recipes have the property “meal” which either has the values “bread”, “breakfast”, “dessert”, “main” or “sauce”, because these are the types of recipes I have.

With my current formula (above) I get a result like this:

COLUMN 1 - COLUMN 2
bread - 40-Minute Hamburger buns
bread - Soft French Baguette
bread - Pretzels
breakfast - Crispy Waffles
dessert - Ladyfinger Biscuits
dessert - Lemon Meringue Pie

But in mnvwvnm’s tag-based index (link above) each tag only appears once, followed by a list of the relevant notes (so there’s no column bread, bread, bread…)

I could achieve my goal by copying his index and just using tags to specify the “meal” for each recipe, but I’m hoping it’s possible to GROUP BY meal.

However, when I add GROUP BY meal, I just get a result like this:

Meal(5)
bread -
breakfast -
dessert -
main -
sauce -

1 Like

Hi Jopp / Everyone,

I did some more searching and finally found an answer on this post:

The query that has achieved my goal is:

TABLE WITHOUT ID
meal AS Meal,
rows.file.link AS Recipe
FROM [[Recipes]]
FLATTEN meal
FLATTEN link(file.link, Title) AS Note 
SORT meal ASC 
GROUP BY meal
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.