Sorting dataview list by time value

What I’m trying to do

I have a collection of recipes. I want to make a dataview table of recipes sorted by the time they take to make. I have a value called ‘Time’ and would like to have a value for that property that is both easily readable for a human and possible to mathematically sort from low value (a few minutes) to high values (days).

Things I have tried

I’ve tried in other similar situations to enter numerical values in the same unit of accounting. For chiles I sort them by Scoville Heat Units (SHU) and can table that low heat to high heat that way. (Only con is they seem to have to be without any dividers, so it can’t be 50.000 or 50,000 as a value, but has to be 50000 to be sorted correctly, which is less readable).

For recipes, it’s not practical to use minutes as the unit of counting. Some recipes take days to make. Or even just hours, and 480 minutes is less readable than 8 hours.

Any ideas?

You’re not stating in which context you’re wanting to use these, so I’m assuming a combination of viewing and possibly querying through Dataview. In either case using durations should provide you with values covering all of those ranges you mention. These are timespans described using common English abbreviations.

Given a legal duration value, you’re also allowed to present these in various formats, or use them for calculations and comparisons and so on.

Regarding the second part of your question on SHU’s and inserting dividers, there is sadly enough not many ways to present number in different format. (Come to think of it, that could be a feature request for Dataview to do number formatting… ) However, I’ve presented one way to do it in the post below:

Thank you @holroy . That answered my most important question which was how to sort durations. I didn’t know about the correct way to input the value (minutes, hours, days etc) so dataview would recognize the right proportions. Now tables are sorted correctly.

As for formatting large numbers and sorting them, it seems this is not possible with dataview at the moment. Thanks for mentioning your work around. I’ll wait and see if it gets picked up in a dataview update eventually. I’m a bit vary of introducing too much code in my notes.

1 Like

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