Dataview seems to be sorting wrongly (soln: use SORT file.name, not SORT file.link)

What I’m trying to do

Sort all files with the tag #week in ascending order by filename.

The filenames begin with a timestamp code in 24-hr format (yyyymmddhhmm), so essentially this should sort in ascending order by date.

Recently I’ve started using the core plugin “Create new unique note” to put the timestamp in the title. Procedure:

  1. Ctrl-N to start a new note.
  2. Click the “Create new unique note” button in the ribbon to generate the timestamp in the note title.
  3. Write the rest of my title after it.

I’ve added timestamps to older notes (before I started using the plugin) by manually editing the titles.

This is the Dataview code. #week is the tag it’s pulling from.

LIST
FROM #week
SORT file.link ASC

Result:

In this particular set of timestamps, things go wrong in the 6th digit, the 2nd digit of the month, e.g. the “5” in “05” (May) and the “6” in “06” (June).

0502
0507
0521 - wrong. “0514” should be here.
0604 - wrong. “0521” should be here, followed by “0528”
0611
0514 - out of place
0528 - out of place

Things I have tried

  • Changed the sort from ASC to DESC and back again to see if either works. (Neither does.)
  • Made sure Obsidian and all plugins are updated. (Everything is.)
  • Closed and restarted Obsidian. (Didn’t help.)

Try doing SORT file.name instead, as I suspect leading text in the links may interfere Wyeth the sorting.

If it now sorts correctly, you might need to change it a little bit more to get the links again. But let us get the sorting correct first.

1 Like

Voila! Thank you. Somehow it seems to know I want links without me saying?

LIST
FROM #week
SORT file.name ASC

image

Also works as a table:

TABLE WITHOUT ID file.link AS "Title"
FROM #week
SORT file.name ASC

image

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