Reference dataview table

I would like to be able to set a dataview table that can be used in many pages. When I make changes it updates in all of the pages it is included in as well, so I only have to change it one place. Is this possible?

Yes. You can embed the note with the dataview query anywhere. To do that just add ![[Name of My Note with Dataview Query]] in any note and either make sure you are using Live Preview or go into Reading View.

Unfortunately this won’t apply the query as if it is in the note it is embedded in. It will simply show a view of whatever query you have in the note. If I am misunderstanding your question and telling you old news, my bad.

Good luck!

Thank you! I didn’t know or think of doing that, so I will remember that. I’m always learning new things. But I am looking for something that will apply the query as if it is in the note its embedded in. I have tried using find and replace in atom and it won’t find things in a dataview table.

1 Like

If your query need to use some expression related to the current note, then you need to gives us more information.
We still don’t understand well your goal.

  1. If you want to use always the same query (and same results)
  2. If the same query but that have conditions related to the current note (same query but different results)
  3. ecc.

Here is the dataview table I am using in my book note. I am using the datatable to pull some metadata to the top so that it doesn’t just have to be a list and I can see more at once without having to scroll. I am still trying get my book template just right and sometimes when I learn something new and want to make a change, I have to go through each individual files which takes forever.

TABLE Without ID
	Author AS "Author",
	join(list(series, seriesnumber), " #") AS "Series",
	join(list(publisher, bookNumber), " #") AS "Publisher",
where =

But if I want to change how my book note looks in a bunch of files at once I have to get into each file individually to do that. I would like to be able to edit my table and have it update across all my book files.

Here is what it looks like in reading mode.

Now I don’t have time to look to your both problems (two help posts). I look to them later.
But just one point about this question: with DQL (I don’t know JS) you can achieve completely what you want > you can’t use an embed query as @I-d-as suggested because the expression (the limitation of the this prefix refers always to the file where you “view” the render).

1 Like

That sounds great! Thank you! I have been trying to learn the query language by reading through the dataview page, but I’m having a hard time understanding how and where to put the different queries in my actual dataview tables. I wish there were more examples like the one they have listed at the end, so I can see how it works. I often learn best by seeing how others do it and then figuring out how to replicate it with the things I am doing.

I’m back…
Well, my last answer is a mess… because here…

… I wanted to said with DQL (I don’t know JS) you CAN'T achieve completely what you want, that’s why the next expression with “…you can’t use an embed query”.

Because this error is embarrassing (giving “false” expectations) I forced myself to find some solution.

So, if you want the same query to use in multiples files and placed in only one place to easily made future changes, my solution is a mix of DQL and a basic DVJS.

Create one note only with your wanted query. For example, the note “” in the folder folderA with your dataview query (only the query, nothing more). For test purposes you can use your query above.

Then, let’s place the query in the other notes. For that we’ll load the content of the “” file, not as an embed but as a “real” content, using a dvjs command await
In your notes place this inline js query (you need to enable js queries in settings > dataview):


Try and tell me if this works, because I’ve never used it.

[ I think there’s another way with dvjs command dv.view(), but that implies a JavaScript file and that is beyond my limited knowledge ]

1 Like

No problem! I was a bit confused, as to what you meant, but I am so happy with the outcome.

This totally works. Thank you so much. I have been trying to figure out how to do something like for a long time. This will save so much time when I have to make changes.

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