DataView Display List of Bullet under Specified Header = Name on any page

Things I have tried

List in a list or table all bullet points under a where clause of a Heading.

I am trying to use the dataview to query any page with a bullet list under a H1 or H2 titled research.

These are lists of hyperlinked titles.

I have a page with a header

Header To List

  • One
  • two

I want dataview to look at all pages and show me the bullet point under the Header To List where that header exists on any page.

Thanks.

1 Like

Hi.
Well, we can “want” many things (“I want a house in front of the sea…”) but that’s not always be possible. :slight_smile:

Dataview works with “metadata” in .md files, not the full content. For now, headers/sections aren’t readable data (but it’s on the way).

When this be possible, I doubt it will feasible specify the list elements after the header…

If you want this type of results, you may need to restructure the way you put the elements in your notes: they need to be associated a some “field” readable as “metadata”.

For example, are these “hyperlinked titles” outlinks to other notes? Are the only outlinks in the note? If yes, they are implicit fields, i.e., metadata for dataview…

1 Like

They are not links, they are bullet point with a url to a website to read an article on, for example.

Research

And I want to create a list with dataview of all bullets under the header research. Is that possible?

Or if I create it as task can I say give me all task on any page with the header of Research?

Without any key to capture any value you can’t have a list under a specific header.
The relation key: <value> is the core of dataview.
For example, use this js query (you need to active js in dataview settings):

`$=dv.span(dv.current())`

This gives all the metadata you can work with.

If you use the trick of “tasks”, you can get that. More, with tasks you can get all indented list elements related with the tasks (before or after), i.e.


- [ ] my links
  - link 1
  - link 2
  - link 3

or 

- something
  - [ ] my task
  - link

With a task query you can get all the list elements directly related with the task.

1 Like

Not sure I follow. How can I create a list of all bullet points under the H2 or resrach on any page? Every page has this H2.

Do you know how to create tasks lists?


# My note

This is my note with some text.

## Research
- [ ] [link 1](http...)
- [ ] [link 2](http...)
  - an indent list element (a bullet point is a list element)
  - another list element nested and with a [link 3](http...)
  - [link 4](http...)
- [link 2](http...)

## My query

Now let's try a dataview query for tasks with the filter for section(header) "Research"

```dataview
TASK
WHERE contains(string(section), "Research")
```
  • note about this query: section is a link… to filter that link without adding the path I transform the link in a string and search the words “Research” on it… this means that all sections (headers) with that word are included → to avoid unwanted headers, you need to use a very specific title or add another filters to limit the source (tags, folder, etc.)
8 Likes

Hi @walkinverse . This kind of query is impossible with Dataview because it can’t see the text content of pages, only things like metadata, fields, and tasks.

If I understand your use case, you have lists of links in many different notes that you would like to collect into one place so that you can read them. This sounds like a kind of task list to me. If you made the URLs into tasks, e.g.:

# URLs to read
- [ ] https://example.com
- [ ] https://example.org
- [ ] https://example.net

…then you could collect them all in one place by using a dataview query like the following:

```dataview
TASK
WHERE !completed
```
2 Likes

Thank you!

My last suggestion.

Deducting that this header is a topic in some notes to add links to research sources, you can adopt also this method:

  • In the note, you can add a specific header to organize your content, but consider that the header doesn’t matter to metadata purposes.
  • For query purposes, add inline fields to each list element (element with link).

An example:

## Research
- rlink:: [amazon](https://www.amazon.com)
- [rlink:: [guardian](https://www.theguardian.com/international)]
- (rlink:: [nytime](https://www.nytimes.com))

You can use 3 types of inline field:

  • key:: value - a full inline field: the key at the start of the line and all the string in same line is the value;
  • [key:: value] - using brackets and placing the field in any place (one or more fields in same lime)
  • (key:: value) - the same of previous type > the difference is in the way how this inline fields are highlighting in preview mode (this last type with round brackets, when in preview mode hides “key::”, showing only the “value”) - go to Settings > Dataview (in Plugin options) and enable “Inline Field Highlighting”.

With this method you can create this simple query:


## Research

### Query for all fields with "key=rlink" per file

```dataview
LIST rlink
WHERE rlink
```

### Query for all fields with "key=rlink" (without file link)

```dataview
LIST WITHOUT ID rlink
WHERE rlink
```

2 Likes

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