marcusolsson/obsidian-projects

Priority sorts incorrectly

Closed this issue · 4 comments

What happened?

I have manually set priority values for several items in a new vault since I know that drag and drop doesn't work at this point. The priority property is set as a number field, but the Board view seems to be sorting the items alphabetically. I've set it to sort by priority, ascending, but I'm seeing the order 1, 10, 11, 2, 3, 4...

What did you expect to happen?

The items should be sorted in numerical order

How can we reproduce it (as minimally and precisely as possible)?

I just created a new project and then assigned a number of existing items to it. Those items have numbers in their names such as "01 - Introduction" or "10 - Something something" so that they sort sensibly in the normal file view. They represent articles in a series and need to be worked on in sequence.

Anything else we need to know?

No response

Plugin version

1.16.5

Obsidian version

1.4.16

OS

Windows

Hello! Could you please clarify the type of your incorrectly sorted field? Natural sorting for strings has been discussed in #671, and solved by #694. It will come out in the next release, so I would mark this as duplicated and close down. However, if the number field is sorted incorrectly, then we should consider this as a bug.

To determine the field type, please refer to the icon on the column header in the Table view. A letter T refers to the text field, and a hash(#) indicates that this is a number field. The number field is supposed to contain pure numbers. Thanks again for your feedback and help.

My "Priority" field is set as type "Number", but they're still sorting alphabetically. The table view does have a "T" in the header and says that it's text, Maybe that's because not all the items in the folder have priorities set on them? I have a filter so that my board only shows items where priority is set, but maybe the non-project items are throwing it off?

My project encompasses an entire folder structure, but there are other items in those folders that don't count as project items. That's about the best lead I have for you at the moment.

I was able to delete the priority property from the table view and recreate it. It's working now, although I still haven't assigned a priority to items that shouldn't appear on the board. It's basically set up the same as it was before, only now the table shows a number symbol in the header.

Blame it on sunspots, I guess.

Glad to know it works. Maybe there is an empty string value in the field you mentioned. Yes re-creation always worth a try when there are not too much notes. I'll look into the possibility on basic field type conversions to lessen the restriction, avoiding these stucks.

Projects tracks files according to the project configuration (folder path, tags or dataview queies). The notes excluded by the filter are still taken into account. However, empty values have low chance to cause problems, as the plugin currently determines field type according to the non-empty values (empty refers to undefined or null, while the empty string "" is recognized as a string).