Dataview, show diferent yaml lines under one name

What I’m trying to do

I want to show in my Dataview diferent kinds of notes on certain topic and then sort them by year. Problem I can’t resolve is that in some notes in have in yaml “When” and others “Year”. Is it somehow possible to show both under the same name? I want to show when and year AS year.

you can try to address the metadata of the file:

Not sure how exactly, but something along the lines of sort by file.ctime.year should do the job.

It would be helpful to see some more of your queries, but you could possible use a variant of the following:

FLATTEN choice(Year, Year, When) as theYear
SORT theYear

This would opt to use the Year if it’s defined, and if it’s not defined it would attempt to use the When. And if that’s not defined, you’d get nothing stored as theYear which in any case is the variable to use for sorting.

It could be doubled up also, in case you want to do something different for when neither is defined:

  choice(Year, Year,
    choice(When, When, "neither is defined")) as theYear

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