How to use the or a property "priority"?

I have a property “priority”. The value can be a number (e.g. 1 for “top priority”, 2 for “also very important” etc.)

I can, of course, then in the view where all priorities are listed on the right side panel click on “priority” and get a list of notes that have a priority through searching for [“priority”] But the priority value (e.g. “1”, “2”) is not listed in the search results.

Is there a possibility (without having to “programme anything”, i.e. for a non-programmer user) to

  • get the priority value listed in the search results
  • get that list, then sorted, the priorities with “1” at the top, followed by 2 etc.?

(It is not about tasks, but whole notes with the property “priority”).

Of course, I could also simply use tags like “#priority1”, “priority2” etc., but would it be possible using the property “priority”?

Things I have tried

The Help page dealing with this is here:

I cannot test now so I’m going blind here. Also, I’ve had issues in the past (probably sorted by now?) and used workarounds with regex syntax, so in your case /priority:[1-9]/ would be a good bet. But most probably you won’t be able to list the files by priority (only filename, dates, etc.).
You’ll need Dataview for that.

1 Like

[Edited:] Thank you. It worked with [“priority”:3], for example, that brings all those with the value 3. But in the list, the values do not show and I did not figure out how to get them in order yet. But having the ability to have all those of one value only listed already helps greatly, thank you.

It’s not priority:[1-9] but /priority:[1-9]/ with the slashes (the last one is optional).

Yes, those quotes…properties queried in the search modal are treated/expected as text, not properties objects.

Thank you. But I somehow have not understood the “/”. When I enter [“priority”:1], I get the appropriate results. When I enter /priority:[1-9] or /priority:[1] or / /priority:1, be it with or without a / at the end, I get no search results.

Well, first of all, one needs to check for the property field, whether it is stored as a number or a text string. If I add the property priority with 1 through the Properties UI, the 1 will be stored as "1". If I go into source mode and modify it to 1, then lint the file with Linter, it stays without quotes.

Also, the space was missing from my query.
/priority: "[1-9]" now works:

  • But this feels too much work, right.

Numbers are not supposed to be treated as text, to begin with. The app should give the flexibility to store numbers as numeric values. Or is this a numeric value that is stored in quotes? It’s confusing and not intuitive.

Thanks for bringing this up as I believe many people are wrestling with these issues.

Entering [priority: 1 OR 2 OR 3 OR 4 OR 5] feels too much work as well, however one can save these queries to Bookmarks with a descriptive name.

1 Like

That is interesting, now, it does work indeed. Yes, that is a strange behaviour of the programme.
Obsidian hast lost me there with the need to “lint the file with Linter”… properties should make it easier, not more complicated to use… I tried without that, and the result would be that the query worked, but I would get a warning triangle on the right side of the priority / value field. (Which says: “type mismatch, expected number” when hovering above it, but, in my mind, could be taken as a sign of priority, so perhaps that would be a perspective (certainly unintended by Obsidian…) to see and use it :laughing:)

However, as this is indeed too complicated, I will consider again whethr perhaps it might be more convenient to use tags after all.

Be that as it may: Thank you very much for your help!

If you should want to dive into DataView, a query like this should work:

TABLE AS "Note", priority
WHERE econtains(file.frontmatter, "priority")
SORT priority ASC
1 Like

Thank you very much - that is very helpful for me to use!

1 Like

There’s no need to use Linter. It’s just useful to have to sort and manage properties.

1 Like

But what about the warning triangle? If in source mode I enter, for example, priority: "2", it appears.

I saw these triangles before with properties that were syntactically sound. Then they disappeared…

It doesn’t show here:

1 Like

I have got it here:

when in source mode it is

I have just updated Obsidian and needed to re-start it a few times, so far, it is still there. I will observe that.

If the search and Dataview query work, disregard it for now.

1 Like

They work, thank you, I will just ignore it for now.

That’s at least good to hear.

You’ve chosen that the property should be a number, but you’ve entered a text (for to the quotes), so Obsidian warns you about that.

To make the warning go away either remove the quotes to make it a number, or change the type to be text again.

1 Like

Entered 4 and (to fiddle some more) specified number:

  • This misery about Properties has been going on long enough.

You may find this useful:

1 Like

Okay, to make the triangle not show, you need to switch to number first and then enter the number.

Secondly, if you open a different note and add the property ‘priority’, the program seems to remember the type last used and will default to number instead of text.
Not only that, if you go back to notes where you previously added the number as text (because you forgot the need to specify number), the property icon is changed to number, but because you entered the value as text, the triangle is shown. Removing the quotes now in Source Mode will make the triangle go away.
Conversely, if you entered the number 1 as number and change to the type to text, the triangle appears.

People must look out for these cases when adding the properties through the Properties User Interface.

Using Templater is recommended.
But if you switched the type back to text, the program will treat the property text again and the Templater-created priority: 1 will be shown with the triangle again in the UI.
The types.json file is updated with the type used last:

So, all in all, Properties will look for the last-used type, making it the default type until you change it and will respond with the triangle with the value not being correctly given.

Solution: use Templates to cut down on fiddling and use property: number, without quotes. Similarly, for Booleans true and false cannot be used with quotes, because then they will be treated as text strings, and won’t be able to be switched off and on…

1 Like