Dataview: Help Needed with Displaying Frontmatter From OTHER Note

What I’m trying to do

Currently I am making a overly complex system of using TWO notes, one is a “Main” note for NPC’s for my D&D vault. The YAML in these notes are for categorization and whatnot.
But I am attempting to use SECONDARY notes to store YAML for flavor text and plugin usage in order to change that 2nd note’s frontmatter. THIS in particular is all functional, just explaining the usage.

What I Request Help For:
I need a functional DV query that returns the frontmatter from the secondary note into a nice table slotted just above the data entry plugin I use that changes the YAML that I want being read. As far as I know, a DV query is the only thing that will automatically populate a table without wasting time on formatting it.

Things I have tried

This one works if it’s ON the page that I use the YAML.

TABLE WITHOUT ID rel, reltitle, reldesc
FROM ""
WHERE file.name = this.file.name

But not if on another note. I simply don’t know how to query it in that exact table, sorting and all. It’s a cheap way to gain a table from another note’s YAML and let me quickly edit it through a plugin that does so.

But it DOESNT work if it is on another note.

BONUS: HOW DO I MAKE THE QUERY LINK TO A NOTE THAT HAS THE SAME ENTRY AS the “rel” frontmatter tag?

My Frontmatter:

---
type: database
rel:
  - GoodGuy Testname
  - GoodWoman Testname
  - AnotherGuy Testname
reltitle:
  - Father
  - Mother
  - Best Friend
reldesc:
  - Relationship with father is strained at best. Although they wish to pursue something more and rekindle life with their family.
  - Relatiosnhip with mother is well close. She loves them and would do anything for them.
  - With them until the end.
relenemy:
  - Badman Testname
  - Campaign Ender
relenemytitle:
  - Bad Guy
  - Big Bad Guy
relenemydesc:
  - Stole Thing Y from them at the market.
  - Started the massacre at Place Z and took over Kingdom X.
---

Or… Is there simply a much easier way to do this?
Only need the DV to work. The Metabind plugin is needed to make the data entry part work.

TLDR; Trying to do something where I use secondary notes that are named " Rel DB - ‘MAIN FILE NAME’ " to store YAML I call/edit via other notes+plugins. This just cuts down on my main notes’ YAML blocks, of which the secondary notes wont EVER be editted manually but through plugins on other pages.

TLDR;TLDR;
I need a way to display the YAML onto a table and cant figure out the DV queries to do so.
Rel DB - Test NPC.md (786 Bytes)
Relationship Test NPC.md (2.8 KB)

So basically you want your source to be that other file.

Two days to do that would be to either use FROM "other/filenane", or WHERE file.name = "other/filename".

And if rel was just one file you could use WHERE file.name = rel. If rel is multiple names like in your examples, which one do you want to use? Or do you want to use all entries?

I am having a hard time explaining this and I apologize.
rel entries in this case ideally could be names of other NPC notes (although I dont know how I’d make them automatically link since theyre entries and not pulling other files) where the reltitle and reldesc entries are informational.

Essentially this is all just reading one file’s YAML, using its YAML as an extension to save space and just queried/displayed by DV. Using the plugin I screenshotted keeps them in that order.

This heavily relies on the table being displayed as is, using all entries.
Essentially just using the YAML of the “YAML Database” version of that note as storage for fields to display in the “Main” note.

Unless you can suggest a different method for just abusing YAML this way.
DV + Another Note’s YAML to display all the entries the way they are in the 2nd SC.
Outputting a table similar or like:

|   rel                |       reltitle             |        reldesc          |
TABLE WITHOUT ID rel, reltitle, reldesc
FROM "YAMLDatabase/DB Test NPC

image

Okay, had some sort of typo somewhere. But now…
I just plain dont know good ways to format this. Or if this is even optimal way of displaying/utilizing this kind of thing, haha. Mostly a experiment. Any ideas?

Choosing a proper data structure can be a little tricky depend on what you want to get out of the data structure. I’ve attached a file holding some examples of various alternatives related to your scenario with some pros and cons listed. Uncompress the archive, and open the file f68/f68920 Various relations.

f68920.zip (4.1 KB)

These files illustrates three different options:

  • Your original variant, which I’m not in favour of since you’re essentially just having various different lists which don’t connect the various details of the various relations
  • A compound object variant, which splits each relation out into their own, so that the details of a given relation follows that relation. However, this looks kind of ugly in the properties views
  • Using dedicated notes to describe the relations. This looks the best in the properties view (IMO), and allows for editing of the various details in their respective notes. The dedicated notes also allow for extended information related to how the relation occurred, or has evolved and so on, which might be worthwhile. This is also the only format which easily allows for links between the various NPC’s and relations and so on

Here is an image of the Johnny Boy (the main character):

And here is an image of the relation to the father:

Note that there are various queries also included in the test files, which hopefully can get you going related to how to query these kind of structures.

Not sure if this is actually helpful in your case, but I’m leaving out there to illustrate that data structures can look very different. And I’m rather sure you could also use some plugin to build something similar, without me going into that rabbit hole just now.

This is ALL ultimately helpful, thank you. Essentially my whole reasoning for this was to offload a sort of “relationship” database that isnt tied to the frontmatter of the NPC- Largely for the sake of just not bloating the frontmatter in any sort of crazy way. Ultimately I was just experimenting and my desire to know how to display those relationships / edit them via a plugin was my end goal, without their YAML needing to be on the ‘main’ page of that NPC.

But seriously you’ve helped me be able to theory craft and I was in the end, just looking for better ways to possibly forgo this method of NotevNote interaction. I will probably spend some time breaking your work down, thank you for the time you spent on this, seriously

But again thank you tons!

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