Best way to search and return text and tags from another note

I have several notes that contains tables as below. How can I pull the information from these tables into a new note

Note 1

First Header Second Header Third header
note1 cell1 note1 cell2 note1 cell3
note1 cell4 note1 cell5 note1 cell6

Note 2

First Header Second Header Third header
note2 cell1 note2 cell2 note2 cell3
note2 cell4 note2 cell5 note2 cell6

Note 3

Query to pull information from the tables on Note 1 and Note 2 and create a dataview table as below

First Header Second Header Third header
note1 cell1 note1 cell2 note1 cell3
note1 cell4 note1 cell5 note1 cell6
note2 cell1 note2 cell2 note2 cell3
note2 cell4 note2 cell5 note2 cell6

What I’m trying to do

Direct answer: you can’t do that with dataview.
Unless you have code knowledge and create a complex code to do a manual parsing of the full content…
Dataview works with metadata, not with the full content… and md tables aren’t metadata.
Dataview docs: Dataview

1 Like

You can use a simple block id like this:

| table 1 | table 2 |
| ------- | ------- |
| cell    | cell    |
^blockid

![[Note#blockid]]

Thanks @mnwvnm would there be alternative way using dataview. The information doesn’t need to be in tables. Say I had

Note1

foo:: Lorem ipsum dolor sit amet
bar:: consectetur adipiscing elit, sed do eiusmod tempor incididunt
baz:: Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
#notes/hello

foo:: Lorem ipsum dolor sit amet
bar:: consectetur adipiscing elit, sed do eiusmod tempor incididunt
baz:: Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
#notes/goodbye

Note 2

foo:: Lorem ipsum dolor sit amet
bar:: consectetur adipiscing elit, sed do eiusmod tempor incididunt
baz:: Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
#notes/hello

Note 3

TABLE foo, boo, baz FROM #notes/hello
SORT bar DESC

The above query returns all tags #notes/hello and #notes/goodbye and doesn’t sort by bar

TABLE foo, bar, baz FROM "folder"
Where contains(tags, "notes/hello")
SORT bar DESC

The second query returns nothing

Any idea where I am going wrong, thanks

This is a recurrent misunderstanding.
You’re thinking that your data works as pseudo-groups inside the same note. That’s no true. Your data works mainly in page level.
I think I explained this multiple times in this Forum. But remains a recurrent error thinking as a group/blocks of metadata.

For example, in your note 1 you have two tags at page level, not related with each pseudo-group.

To play with dataview we need to understand first the metadata structure.

If you want to see the metadata structure in specific file, place this inline js query in that note:

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

(enable inline js queries in settings > dataview)

thanks for the reply and detailed answer.

To be honest I think this is too complicated for me and doesn’t seem to do a lot of what I thought it would do. I assumed it would be a simple task to pull data from other files based on a tag.

I might need to sadly go back to Notion which was much easier to understand and use

It’s easy to pull out data from other files based on a tag… But the main issue in your metadata structure is: you also want “groups” of data inside the same file.

I used Notion databases (in basic way), but I think there the issue is the same: in Notion you need to define data per file, not groups inside the same file.

With dataview you can create a kind of groups if you use data based in a common value.
For example, it’s possible to collect all list itens (bullet point lists) or task based in the header/section.

An example

Note 1

## hello
- foo:: Lorem ipsum dolor sit amet
- bar:: consectetur adipiscing elit, sed do eiusmod tempor incididunt
- baz:: Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris

## goodbye
- foo:: Lorem ipsum dolor sit amet 2
- bar:: consectetur adipiscing elit, sed do eiusmod tempor incididunt 2
- baz:: Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris 2

Note 2

## hello
- foo:: Lorem ipsum dolor sit amet 3
- bar:: consectetur adipiscing elit, sed do eiusmod tempor incididunt 3
- baz:: Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris 3

One possible query for lists under the header “hello”:

TABLE WITHOUT ID
	key AS File,
	filter(rows.L, (r) => r.foo).foo AS foo,
	filter(rows.L, (r) => r.bar).bar AS bar,
	filter(rows.L, (r) => r.baz).baz AS baz
FROM "your/folder/path"
FLATTEN file.lists AS L
WHERE meta(L.section).subpath = "hello"
GROUP BY file.link
SORT rows.L.bar DESC

1 Like

Ok thanks for explaining where I was going wrong. I have a little better understanding of what dataview can do. Will try this and feedback how I get on. thanks for all your detailed responses

1 Like

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