Dataview sorting?

What I’m trying to do

I’m trying to get a NPC note to show Quest that only that NPC gives in dataweiw.
I want it to work with my template, when i press a button for new NPC it create a new “NPC rename me” so when i change the name on the note i dont want to edit every Datawiew everytime

Quests are made in another note with more detail

Things I have tried

I’ve tried to use WHERE and this.file.name and did not get it to run how i want. Either showing all #quests or errors, I’ve tried adding Questgiver to where or from did not get it to work.

Hope you understand what im after thanks in advance

To show tasks from all quests in which the NPC is a Questgiver, try this query in the NPC note:

TASK
WHERE Questgiver = this.file.name

The query assumes every quest has only one quest giver. And it doesn’t use #gregor because the quest your showed isn’t tagged #gregor.

To reduce chances for typos and to automatically handle any NPC name changes, you might consider changing the quest giver value to a link:

---
Questgiver: "[[Gregor]]"
---

If you do that, then use this query instead, which replaces file.name with file.link:

TASK
WHERE Questgiver = this.file.link
1 Like

Thanks that did it i did go for file.link :grinning_face:
but if i wanted to have multiple questgiver to the same quest do i just have to input more in questgiver? or does that messes things up?

How do i get the datawiew to show the linked Notes in Questgiver from this note?
im i on the right track or do i think all wrong?
and i only want the NPC in this quest and no other

How do i get the datawiew to show the linked Notes in Questgiver from this note?

You were close. Just two changes: (1) Let Dataview know you mean this note’s questgiver instead of the queried note’s questgiver, which doesn’t exist. (2) Change name to link. That gives you:

WHERE this.Questgiver = file.link

but if i wanted to have multiple questgiver to the same quest do i just have to input more in questgiver?

If you make Questgivers a list-type property like this:

---
Questgiver:
  - "[[Greger]]"
  - "[[Tania]]"
---

… then use this Dataview in the NPC note:

TASK
WHERE contains(Questgiver, this.file.link)

… and this in the quest note:

LIST
WHERE contains(this.Questgiver, file.link)
1 Like

Thanks Alot for help and feedback

i got the NPC to work but the Quest dont want to work, mabye im missing some
i have tried both with and without FROM but it just dont work.

it looks like this

You spelled it “datawiew” with a “w” :grinning_face_with_smiling_eyes:

Make it “dataview” with a “v”

1 Like

ahhhh Thanks :rofl:

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