
Jason Evert shows how to build nested Dataview queries in Obsidian to organize files hierarchically, then add a button that auto-generates new notes from a template. You'll set up four plugins (Dataview, Templater, Buttons, QuickAdd), create a master collection note, and link it to a template folder so clicking the button instantly creates timestamped notes in the right place.
Chapters
Hey, how's it going, YouTube? It's Jason Evert here, and today I wanna share with you how you can create your own nested Dataview queries. So this is something I've recently discovered and I found it really helps to increase the efficiency of finding different files within your vault. For example, you can see this note that I've created over here, and this is a simple Dataview query. But the cool thing is this is actually a Dataview query of Dataview query. So what does that mean? Like, whenever I click on one of these notes, you can see it opens up another note with even more, um, different things that I can, that I can select. And by doing this, I'm essentially building my own sort of file management structure. Okay. And the beauty is that it can just be customized whatever way you want. Um, now if this is your first time using Dataview, I would highly recommend you first start by watching this video that I've created on how to start Dataview for beginners. However, this video is going to be a little bit more advanced. And what I'm gonna show you is number one, how to actually create one of these nested file structures with Dataview. So for example, when you click here, this is gonna open up another Dataview query with the different books that I have. So that's the first thing I'm gonna share with you. And then the second thing is how to add one of these buttons that allows you to essentially create new notes within your Dataview. Basically, whenever I click this button now, it's gonna actually give it a second and and it's gonna show a new note specifically set up with a template that I've already designed. This is basically around thinking time, which is from the book, "The Road Less Stupid." Highly recommend to check that one out. So let's dive into how to actually do this. The first thing that you're gonna wanna do is you need to have a list of different collections. So the way that I even discovered that I could do these nested Dataview queries is I started with this folder that you can see over here and I have a whole bunch of different collections. I've got like different tasks that I wanted to complete. This is all the different notes within my vault. Oh, this one's gonna freeze my whole computer. All right, but yeah, so this is all the different notes within my vault. And then essentially, once I had all these different collections, those were my initial Dataview notes. Then from there, what you'll notice is that all of these different Dataview notes over here, they've all got the same YAML. So this is basically what you wanna add to each one of these notes. So I've got the category collections and you can see each one of these, the thinking times also got category collections. So by just adding that category collections, that's the criteria that I then use for the main note, which is called all collections. And then you can see inside of the actual data view block, all I'm doing is I'm just saying where it contains category collections to go and find all of my different collection notes and then put them in one big collection note. So that's kind of how this works. There's not really too much more to explain around that. Let me know if you have any questions on that. So the second thing then is when you have that created, how do you create this, this button plugin that essentially allows you to add new notes on command? Well, how do we actually set that up? Well, the first thing you're gonna wanna do is make sure that you have these plugins installed. The first one you need is Templater. Okay? So you wanna make sure that you go to your community plugins. Over here, type in Templater, and then make sure that you have this plugin installed. This one is absolutely amazing. I use this pretty much every single day now because it just helps in so many different ways. So that's the first one. The second thing of course is that you're going to definitely need to get the Dataview plugin. So if I just go back to the community plugins, I'm gonna go here and type in Dataview. All right, but by this point you should already know how to use Dataview. So Definitely make sure that you have Dataview installed. And then the last one, uh, actually second last one that you're gonna need is the Button plugin. So this one, um, you, it's just called Buttons and you wanna make sure this one is, uh, is installed by Sam Morrison. And then the last one that you're going to need is gonna be this one. I believe it's called QuickAdd. So QuickAdd is essentially the plugin that I'm using to automatically create notes based on the templates. Okay. Now that you've got these plugins installed, let's look at how we can create this functionality with the button that automatically adds to this data, data view query. Okay. So first thing to look at is your templates. All right. So you can see here is my templates folder. These are all the different templates that I've got. By the way, if you want to get access to this folder and then the blueprints and different frameworks and workflows, I've already created. You can download my vault inside of, uh, Patreon with the link in the description. But basically here's the different templates, right? And this is the template that I use for Thinking Time, right? And then this is gonna be, um, the starting point for the, uh, for the plugin, right? So if I go here to templates, uh, well actually no, not to templates, to Templater. So this is the plugin that we just installed. You're gonna see it's gonna ask for your template folder location. And basically the folder location is just actually gonna be, uh, I don't know why it's not there. So folder location is gonna be templates. All right? Now the, the value of doing that is then whenever you wanna create a template, like let's say I wanted to create a new template here, I'll just click Alt+E and it's gonna show all of my different templates. And literally just by clicking one of these, like for example monthly, it's gonna add that template over there. So that, uh, is already like why templates are so cool. Okay? Now once that's installed, uh, and once you've got that whole plugin set up, the next thing is that we want to go here to the Button plugin. So actually, um, no, the Button plugin is completely fine on its own. So once, uh, that's done, now we want to go to QuickAdd. Okay? So QuickAdd is basically where the magic happens. This is where we're gonna take the, the code from the Button plugin and we're gonna create a new automatic action that happens when, oh, that we've created. Okay. So you can see this is the only entry that I've got in QuickAdd. I've got a template, new thinking time session. So we can see this is the template note, thinking time. This is a thinking time entry. All right. So hopefully you're following me on that. And basically how does this actually work? So inside of this new thinking time session, uh, QuickAdd function, What I'm gonna do is it's gonna ask me for the template path. So what I, what I do is I just go to my templates folder and then I link to that note, the template note that I've already created. All right, then you just wanna make sure you copy these settings. So file name format, you keep that the same. Um, the file name, I've got, I've got this one set to TT episode, Thinking Time episode. And then I've also got, um, this option selected, create in folder. Okay, so when you select this, it's gonna ask you which folder do you want to create the notes in? And then I've created a specific folder location called Thinking Time Sessions and then First Season. All right, so this is basically the folder structure that I've already set up. And just to illustrate that, you can see here Thinking Time Sessions, and then there's a folder First Season, and these are the different Thinking Time notes. Okay, so just going back over here. Um, once that's actually, um, set up, what you're gonna do, you, you're gonna add like the folder path and then you have to click on add over there. All right? So just make sure that you've got the, the right folder that you wanna send it to. And then basically, yeah, just keep these settings all the way the same. I turn on increment file name, which is pretty cool because I just set this to episode 1 and then it's automatically gonna update it to whatever's the latest file name. So You can see right now we are on episode 5. And then also you have these options open in the file created or new tab, open the file created in a new tab. So just to demonstrate that functionality, if I go back here to my Thinking Time session, so click there. Let's say I wanted to create a new one. It's gonna open it in a new tab and then I literally have it right there. So that's basically the setting. This is how it's, it's all set up over here. Um, again, just so you can see it, make sure that you just copy this. Now we're not done yet. The next thing that you have to do is once you've created, um, that template and you've already created the, now the quick add function, the next thing is you can see this is a piece of code over here. So inside of Obsidian, we've got these code blocks and this is basically the code that you wanna create. So I'm gonna just add this in the description. You can literally just copy this and then you can add this to your note, but basically it's gonna be 3 of these inverted commas. And then you're gonna have the button name, New Thinking Time Session. So basically what we're doing is we're naming what the button looks like. Like if I just go here, you can see name of the button is New Thinking Time Session, right? The type is a command, okay? And then the action is quick add. So now we actually just put the quick add template. Oh, so we just put the words quick add there. and then as long as you just copy this exactly, it'll, it'll work, I promise you. And then you literally just add the name of your quick add template. So here again, you can see I've got it called template New Thinking Time Session. And when I click on the settings, got template New Thinking Time Session. So whatever you call this, you wanna just copy that name and you wanna put that, um, for the button over here. Sorry, you wanna put that same name in the button here. So Template, new thinking time session. So once that's done, okay, and you've been able to follow all the steps, I know it's a little bit tricky to, to understand that, but once you follow all these steps, then you will have one of these buttons. And when you click it, it's gonna just do the quick add action that we've already just set up. It's gonna find that specific template, um, the template note that we created, this thinking time entry note. And then from there, it's gonna automatically created inside of here so that we can just, um, use the exact template that we want. And that's pretty much it. So, um, I know this was kind of two videos in one, but I just wanted to share with you all of these features. So now you know how to create a nested, uh, dataview query, and then you also know how to create one of these buttons that allows you to quickly add to recurring notes that you wanna set up. Thanks for watching this video. And by the way, if you are someone who wants to start using Obsidian, you know the value of Obsidian, you wanna start using it every single day, kind of like I use it right now to manage my entire life, basically. Then if you want to get help on how to actually start using it, I'm more than happy to help you if you just send me a message on my Patreon, and, uh, I'd love to help you with that. So again, thanks for watching this video. If you have any questions, let me know in the comment section below, as well as if you have any ideas for future videos, I would love to hear them, and I'll see you in the next one. Bye-bye.










