Dataview daily notes including images and code blocks

Hi

currently I have a projects notes page where I aggregate all daily notes for the project:

TASK
FROM "Daily Planner"
WHERE contains(string(section), "PIPE NOTES")
AND text != ""
GROUP BY date(file.name) as DT
SORT DT desc

problem is this doesnt include the attached images and code blocks I note down on the daily note under PIPE NOTES, I do only strings now. Is there a way to aggregate images and code blocks etc too?

A pure Dataview query doesn’t have access to the plain text of a note, only metadata and fields associated with the note. So there is no section unless you’ve defined it within the file. To read the actual file content you’ll need to switch to Dataviewjs and read the file manually.

The query you’ve listed pulls out the tasks of the file from that given section, and unless the images you want are part of that task, then that query will not be able to lift it.

Some queries can be written to lift images, as they’re linked from the file, possibly filtering to the section.


However if you want to pull all the text, like tasks, text, images, code blocks, … you do need to look in the forum for some script pulling all text related to a section using javascript (which can be done from dataviewjs).


A cleaner alternative in some cases would be to switch to using lists to denote the information to be gathered on the project note. Imagine doing something like the following in a daily note:

- (project:: Pipe notes) Cut the pipes all together
- (project:: Another one) Did something different

Then you could the “Pipe notes” related information using:

```dataview
LIST item.text
FROM "Daily Planner"
FLATTEN file.lists as item
WHERE item.project = "Pipe Notes"
```

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