DataView question (something that used to work...?)

Hello all,

I used to have a nice little setup with DataView that I liked, but it seems not to function anymore. But as a programmer, I’m much faster to cite user error than developer error. :wink:

So here’s what some of the YAML looks like:

status: 2
 - 📆 Scheduled
 - ⚙️ In Progress
 - ✋ On Hold
 - ✅ Complete
 - ❎ Will Not Do

And here’s the corresponding query:

TABLE as Title, statusList[status] as Status
FROM "Things"
WHERE status = 2 OR status = 3
SORT priority DESC

While I’m able to pull up an element of the statusList member by using a raw index, for the life of me I cannot get statusList[status] to return anything. I’m not entirely sure if it’s returning zero (I tried dropping some text in the zeroth statusList slot, but nothing changed) or if it’s just politely ignoring my yet-undiscovered mistake. =)

As the title of the post mentions, this layout did work at some point in the not too distant past, haha. Needless to say, I’m puzzled and would love any feedback.

Thanks in advance everyone!

First, is your dataview plugin up to date? There have been a bunch of updates recently. Second, dan you pick one of your files with this YAML as a test file and display:

TABLE file.frontmatter
FROM "testFileName"

That should show whether it’s picking up the list as a list properly. If blank, then there’s a YAML formatting error getting in the way of parsing your frontmatter. You could also add statusList or status as columns to this table. I know dataview has had some issues with emoji parsing, so its Issues and Discussion pages on GitHub might be places to look if you get confusing results from the query for file.frontmatter
Good luck!

Yep! Up to date and the front matter attributes are accessible/the emojis display correctly (at least when I pull the whole list, or a single item with an integer literal for the index).

But… this is an older vault. I’ll try recreating it from scratch to see what happens, haha.

Right, so it’s obvious there was some cruft hanging around from the older vault.

Now that I’m working with a fresh setup, there are indeed some noticeable changes to DataView. =) There were when I updated the old one too, but relevant to this post is that my little trick of using as Title to replace the “File” first column doesn’t work anymore, haha. But since you can set the name of the first column now, that’s fine by me.

The status array still doesn’t want to give a sensible result, though. I can get the appropriate integer, and I can get the whole/partial lists with fixed indices, but no luck with pulling from the array based on another value within the YAML.

One more thought would be to make sure “status” is being seen as a number not a string when you are using it as an index. I think there is an explicit number function you can use to convert. I am generally quite confused though, and never would have guessed about the vault cleanout. Good luck!

Never mind, I see you got a bugfix from the dev. Nice work!

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