Dataview Sort not Sorting

Things I have tried

various code, research

What I’m trying to do

I’m trying to sort a 3 column table, but the column isn’t sorting. Here is my code:

TABLE WITHOUT ID Phrase, Source, Topic
WHERE Type="Turns of Phrase"
SORT Topic DESC

Additionally, there is a “(1)” after my phrase column. What is that indicating?

here’s a screenshot of the whole page

Maybe there’s a better way to create a catalog of terms and phrases. Open to ideas.

Good catch! These issues are actually related.

What you are asking dataview for here: “Find all notes in my vault where the field Type has value Turns of Phrase. SORT those files by the value of their Topic field, DESC. Don’t display the link to the filename (WITHOUT ID). Display the Phrase Source Topic fields.”

So you get a (1) because there is 1 note that matches your query. Sorting 1 result does nothing. Your fields have values that lists, so they are displayed as rows, but dataview does not actually know how the various values in the lists correspond across lists!

Taking a step back: what are you trying to do here and what would you like to be able to query?
The easiest (in terms of dataview query writing ONLY) way to make sure your individual phrases get correlated properly with source and topic would be to make 1 file per phrase. But that might not fit what you want to do at all! Maybe instead you want to list phrases you liked on the note for the source you found them in. Then you’ll have to figure out a way to correlate individual phrases and topics when you are writing them down. Maybe you want to list all your turns of phrase in one file like you are doing now! Conceptually, you want this sort of grouping (TurnOfPhrase: (Phrase: "a swingy walk") (Topic: "Movement")) etc. but I don’t know how that’s best done in dataview annotation syntax.

Hopefully this helps clarify what’s going on, and helps you on your search for solutions. As well as this forum, there’s a “Discussion” page on the dataview GitHub that might be worth searching for similar examples of nested fields or correlating lists. Something to search for on this forum might be how people have stored and searched for vocabulary words or language learning, since those have similar “correlated lists of words” properties.

Good luck!

1 Like

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