Dataview quiery of file-sections

Hi guys,

in my daily working routine, I log every call, meeting, … in Section 2 of an obsidian-project-note, as shown in the following screenshot:

If I work for a long time on one project, lets say over a year, there will be a lot of protocols logged, and I’d like to have the possibility to “filter” that obsidian-project-note for all protocols / logs I made for example with “Customer 1”. In other words, I want to generate a dataview table of all logs with “Customer 1”.

The table should have the following two columns:

  1. column: link to the header of that protocol (“for example 2022-07-12 Call with Customer 1”)
  2. column: all content, I wrote within that protocol

I think the code should somehow look like this, but I do not know the correct fieldnames.

TABLE WITHOUT ID 
	file.section.link AS "link" 
	file.section.content AS "content"
WHERE contains(section-header.text, "Customer 1")
WHERE file.name = this.file.name
SORT Tasks.due ASC

Can you help me with that?

Thanks a lot in advance,
kind regards,

Silias

Hi SiliasOS,
For text in your file like section headings and contents, you’ll want to look at an embedded query using the built-in Obsidian search, rather than dataview. Dataview does not have fields for all the text and section headers, (with the exception that you can get the section headers for tasks I think), which is why you cannot find the field names.

Instead of dataview, try something like this:

```query
section:("Customer 1") file:(...)
```

(What goes in … for the file name? I apologize, but I do not remember the answer. I know there was a forum post recently about how to do an embedded query that limits to the current file.)
@CawlinTeffid ping for your embedded query expertise! Do you remember how to limit a query to the current file name?

Hi scholarInTraining,

thanks a lot for your help!!!

I tried the following:

image

The result is not already that what I’m looking for:

I looked it up in the obsidian help, and there it says here:

  • section:(...) will perform the subquery on a section-by-section basis, where each section is the text between two headings, including the first heading.

What I get in the embedded search as result, are all the matches of “Customer 1”, but I like to have the search just on the headings, and get an result of all that content, I wrote underneath a heading with “Customer 1”…

Do you know how I could do that?

Thanks in advance,
kind regards,

Silias

1 Like

Sorry, I am very much not an expert in this, so looking for other forum topics on “embedded query” may be a faster process.
I think I read somewhere that line:("###" AND "Customer 1") would match headings h3, h4, h5 or h6 (since all contain at least 3 “#”) that contain “Customer 1”, but I am not sure that that query will display for you the whole section started by that heading.
I really hope someone else can chime in, or that other forum threads have helpful answers. Good luck!

Alright. As I couldn’t find a possibility, to change the topic of that thread, I’ll compose another one.
Thanks anyways! :slight_smile:

1 Like