Need help embedding full block from a query

Things I have tried

I’ve tried using Google to search about Obsidian query, as well as reading the Obsidian Help on Search. I see many options on modifying what you’re searching for, but not modifying what’s returned.

I’ve also tried dataview, but it only returns the name of the note, not the contents. So instead of at least getting part of the block, I get a single line with a link to the note.

What I’m trying to do

I have multiple health issues, and I have started a health journal. Obsidian looked like the best option, so I’ve started using it for the journal.

I started with one note per issue, plus one for what I’m eating (due to allergies). I thought that it would be better to have one single note so that I could see correlations between foods and symptoms. So I moved all of my entries into one note as a list, with one or more tags at the end of each list entry. I figured I could use a query for each doctor with the relevant tags (my rheumatologist and neurologist share concerns, but not my chiropractor, etc). However, when I try using the query syntax to embed in a different note (i.e. #arthritis), I don’t get the entire block (list item). I get an ellipsis and then the last part of the block. That’s not going to help any of the doctors.

I’ve tried #arthritis, tag:#arthritis, block:(tag:#arthritis), etc. They all seem to be telling obsidian how to select text, but I can’t find out how to tell it to include the entire block. Am I missing something? Or is it not a capability in Obsidian?

Thanks!

BEn

1 Like

I have been trying to do the same in my vault.

Query can select blocks but doesn’t display the full block.
I am quite new to dataview, and I have not seen anyone using it to retrieve blocks.

Would appreciate if we can get some help on this.

You can use Dataview to get something close to what you want.

For example, I put this text in my daily note:

  • TestTag1:: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  • TestTag2:: This is a test.
  • TestTag1:: This is another test.

Then I added this query to another note:

```dataview
table TestTag1, TestTag2
from #journal/daily 
where TestTag1 or TestTag2
sort file.day asc

This is what the result looked like:

You will have to replace the “TestTag1” and “TestTag2” with the appropriate labels. I don’t think you can use a #tag as the field name (i.e .before the double colon), but you should be able to use it in the field value (after the double colon).

1 Like

Hey, thanks! It’s a bit of a kludge for a feature that should be part of the main application, but I’ve gotten it to work. I don’t know why they don’t replicate the Search functionality in the inline query, but this is an acceptable compromise. I’ll just create individual notes, tag them appropriately, and have Text:: in front of every block I want exported.

Thanks a lot! This lets me do what I need to do.

Okay, I thought I’d share exactly how I did this in case anybody else is trying to do it.

  1. I enabled the dataview community plugin
  2. I refactored my notes. Before I had a couple of large notes with multiple entries, one with my headache entries, one with my arthritis entries, one with my food diary, etc. Instead I now have my note names only being date and time. Then I have the dataview field Text:: and then the block with my comment. Then a new line and any tags (I do it that way so the tags aren’t part of the data pull). (example below)
  3. I have a separate note with the dataview query (code below).
  4. Because I’m ending up with multiple notes per day (instead of a Daily Note and pull by tag, which I’d prefer), I’m grouping notes in folders by month. So I have Journal->2021-10->each entry.

Capture-01


Capture-03

2 Likes

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