Can anyone help me format a couple of Dataview queries? I’ve tried the simpler of the two 16 ways to Sunday and I can’t seem to figure out the right syntax to make it work.
I want to use two similar, but separate, queries, to spit out lists of recipes that contain particular ingredients. We’ll use apples as an example.
In both cases, I’d like it to list the recipe name (field is called “name”), source (field is called “source”), and the folder location, alphabetically sorted by the name – and preferably to not include the filename, which will duplicate things.
This first query should be fairly simple, if I had any idea what I’m doing. I have a field called “main_ingredient”. I enter this manually for every file, so it’s formatted pretty consistently. (e.g. “apples” will always be “apples,” never “apple.” The one potential complication is that some are multiple words (e.g. “boneless chicken breasts”).
I just want this query to spit out a list (or table, if that’s what I need for multiple columns) of all the recipes that have main_ingredient “apples”.
This is about as far as I’ve gotten, but no matter what I adjust, I keep getting errors and can’t figure out what I’m doing wrong:
The second query is a little more complex, and I’m not sure if it’s possible. The primary ingredients list for this database produces ingredients that look like this:
[0.5, 'cup, ‘apples’, ‘sliced’, ‘1/2 cup apples, sliced’]
The first set of single quotes are the numerical measurement, the next is the unit, the third is the actual ingredient, the fourth is any preparation instructions or other details, and the last is the version to be displayed to the user.
There are two potential issues to this query.
I only need it to check against the actual ingredient section of the ingredient entry – not the preparation, the display, etc. (Otherwise I think I might get two of everything?)
I need to find, for instance, any ingredient listed as “apple” or “apples” but not “applesauce”.
If someone can show me what these should look like, I should be able to identify how they work and adjust accordingly for other searches. But I’m apparently not understanding the documentation I’m reading.