Hi,
I tried this looking through sample vaults and reading documentation, but could not find what any way. I hope somebody here would point me in right direction. Thank you!
What I’m trying to do
I have daily lists where I put e.g. food log.
Everyday it looks like
- banana
- apple
- apple
I want to seach my notes in “food/” folder, where typical notes looks like:
apple.md
calories:: 80
calories_per_100g:: 100
also_known:: granny smith
and I want output total calories (or calories for every row) below the list.
something like 100 + 80 + 80
Is this possible with obsidian?
I know that table processor would be easier to use. Thank you!
It’s possible but do you only use list items for food logs? Or are they contained in another section or something like that?
Given they’re the only list items you could do something like:
```dataview
TABLE foodLink as Food, foodLink.calories as kcal
WHERE file = this.file
FLATTEN file.lists as item
FLATTEN link(item.text) as foodLink
```
This would show the calories associated with each list entry, but not sum them. If you only want to sum them you could do something like:
Total calories: `= sum( nonnull( map(file.lists, (m) => link(m.text).calories)))`
It still relies on you only using lists for food logs, which is kind of illogical. If they’re contained in sections you would need to filter down the file.lists
accordingly. Another option could be to use tasks with a given custom status, or adding the links to the list item and filter on items where the first link is actually to a food note…
In short, it should indeed be possible to do what you want, but your syntax for listing the food items is maybe a little scarse making for either false posititives or extra information not being food items.