How to Grab Values from the Linked Note?

First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.

What I’m trying to do

I like to drink, especially alcohol liquer.

I drink different drinks almost every day, and I want to use Obsidian to record information and tasting notes about what I drink, something I’ve been doing manually.

Here’s what my frontmatter of drink notes look like

Budweiser


ABV: 4.5
Taste: Just normal lager taste, a little bit lighter

And in the frontmatter of my daily note, I have this part

2024-07-10


What_To_Drink: [[Budweiser]]
How_Much: 335

What I want is, [[Drinked]] inside a document called [[Drinked]].
Column 1 will search for documents in the daily notes where What_To_Drink is not empty,
Column 2 gives me the drinks consumed that day.
Column 3 multiplies how_much by the abv to calculate the actual amount of alcohol consumed.
Column 4 brings up Taste.

Things I have tried

First, I can make column 1 and 2 easily.

TABLE WITHOUT ID link(file.link, title) as "Date", What_To_Drink
FROM "Daily Notes"
WHERE What_To_Drink != null

However, I found it quite difficult to create a third column.
If this were in the [[Budweiser]] document, I could make it like this

TABLE WITHOUT ID file.link as "Date", How_Much*this.ABV/100 as "Actual Alcohol"
FROM [[#]]

but It’s not. How can I make it?

One step forward. There are still issues, but whatever…

TABLE WITHOUT ID link(file.link, title) as "Date", Drink, How_Much as "How Much", Drink.ABV as "ABV"
FROM "Diary"
WHERE Drink != null AND How_Much != null

This will create a table that looks like this

Date Drink How Much ABV
[[2024-07-16]] [[Budweiser]] - 350 - 5
[[2024-07-17]] [[Corona]] - 350 - 5
[[2024-07-18]] [[Jack Daniel’s Old No. 7]] - 45 - 40
[[2024-07-19]] [[Smirnoff No 21]] - 30 - 40
[[2024-07-20]] [[Cham Iseul]] - 150 - 16.5

I was really excited to get this far, but then I ran into another problem.

When I added How_Much*Drink.ABV/100 as "Volume of Alcohol" after the ABV, I got the error below.

Dataview: Every row during final data extraction failed with an error; first 12:
    - No implementation found for 'number * array'
- No implementation found for 'number * array'
- No implementation found for 'number * array'

I’ll have to do a little more research

Final touch.

I don’t know why on earth Drink.ABV is implemented as an array, but I simply treated it as sum(Drink.ABV).

The end result is this

TABLE WITHOUT ID link(file.link, title) as "Name", Drink, How_Much*sum(Drink.ABV)/100 as "Total Alcohol Volume"
FROM "Diary" OR [[#]]
WHERE Drink != null AND How_Much != null

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