Dataview: Sort tasks using inline metadata like [Rating::⭐] which is not a number

What I’m trying to do

I want to sort a dataviewjs task query by inline text metada like [Rating:::star:]. There’s no problem when the metadata is a number, but idk how to do the query when the metadata is a text.

Things I have tried

dv.taskList(dv.pages("#books").file.tasks.sort(k => k.Rating,'desc').groupBy(t =>t.tags), false)

The trick is to somehow turn your value into a sortable value. One way to do so is to use your value as the key into a dictionary of their assigned numerical value.

I.e. one star could then be 1, two stars 2, and so on.

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