Dataview table from multiple notes

Things I have tried

Researched how to link two notes by frontmatter data and display data in a summary table.

What I’m trying to do

I have a directory with project notes. These notes all of frontmatter data like this:

---
date: 2022-12-02
type: project
description: This project will do something
status: In progress
disposition: OpenAPI definition is complete.
invoice: Invoice1234
---

And then I have a directory of invoices where the filenames are in the form of Invoice1234.md. The have frontmatter data like this:

---
type: invoice
datesubmitted: 2022-12-05
amount: 300
datefunded: 
---

I would like to get a table that shows the date, description, status, and disposition of each project, and the if the invoice field has a value, retrieve the amount, datesubmitted, and datefunded and use that in the table as well. So the result would look something like this:

project description status disposition invoice amount datefunded
Project 1 My proj Completed Done Invoice12 300 2022-12-01
Project 2 My proj In progress Working - - -

What would be the dataview query to do this?

Thank you.

I put the question in reverse: what’s your start dataview query attempt?

table description,status,disposition
from "Projects"

I know its not much, but Im stuck here because I dont know how to pull the invoice data from invoice associated with the project note

Is “Projects” a first level folder?

Yes. Projects is a folder. Projects and Invoices are both first level folders.

Values in invoice are “unique” names of files? I.e., there’s no other file in your vault with the same name?

Correct. Value of invoice will always be in the format of Invoice# and those will always and only be in the Invoices folder.

Try this (valid for unique names… if not, link() method fails in creating the wanted link):

TABLE
	description,
	status,
	disposition,
	invoice,
	link(invoice).amount AS amount,
	link(invoice).datefunded AS datefunded
FROM "Projects"
1 Like

Thats perfect. I knew about the link() function, I have used it in other notes to create a link, but it completely did not occur to me to use the link as referenced object to what was bing linked and then have access to the frontmatter like that. Brilliant! And yes, I do understand what you mean about the unique file names because if it wasnt then link() wouldnt know what to link.

Absoutely perfect. Thank you. This is only my second day with Obsidian, hence the un-familiarity with these things, but I can tell this is going to be a long term friendship with this app and its plugins.

Thank you again.

If, in alternative, you change the values in invoice to links - invoice: "[[Invoice1234]]",
then you can target the wanted value with invoice.amount.

Ooooo…thats even better. I will do exactly that.

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