Queries for a subkey spit out a mostly empty array

Things I have tried

I’ve tried using Contains to get this to work but I’m still trying to find my feet with Dataview/JS in general and might have gotten it wrong.

I have also tried dot notation and using square brackets like:


I have also tried Nil and “” in the where clause to try filter out empties, no joy.

What I’m trying to do

I’m trying to display data from a key with one or more subkeys beneath it. This is to store information about spells in such a way that I can run requires on them semi-intelligently.

Here’s an example of the YAML I have:

spellName: Burning Feet
spellFavourite: y
spellSchool: evocation
spellDescriptor: ['fire', 'acid']
  - wizard: 1
  - bard: 3
  - cleric: 4
spellCastingTime: '1 standard action'

Now hypothetically let’s say there’s another spell called “Burning Buildings” which is a wizard-only spell.
Currently I’m just not including the other classes in there which works great! I can pull the spell easily.

If I have another spell called “Burning Spleens” that’s Bard-only though it’s showing up in my query, except that in the LVL column it’s just empty.

Furthermore, Burning feet here will show up in LVL, but as list with value 1 in the proper spot and two empty spaces below.

Here’s the query I’ve used:

spellLevel["wizard"] AS "LVL",
spellLevel.wizard AS "test",
spellSchool AS "School",
spellRange AS "Range"
FROM "game notes/spells"
WHERE spellLevel.wizard != Nil

I’m not really sure what I’m doing wrong here, any advice would be appreciated!
ps: Unsure if this is relevant but I’m using the Blue Topaz theme.

try this format:

  wizard: 1
  bard: 3
  cleric: 4

To check only cases with value in wizard you just need to write WHERE spellLevel.wizard


Thank you very much, that’s solved the display issue quite neatly!

1 Like

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