REDDIT 原始帖子

Different display names for property in Bases?

Hello! I wanted to ask if there is any way of customizing the display names for property values in different Bases. I know property names themselves can be customized per-base, but I don't think the same is true for individual properties. I have a status…

原帖正文r/ObsidianMD

Hello! I wanted to ask if there is any way of customizing the display names for property values in different Bases. I know property names themselves can be customized per-base, but I don't think the same is true for individual properties. I have a status property for different kinds of notes (TV shows, books, games...) with values like 1 - Reading, 2 - To read, and so on. Currently there are 'duplicates' of every value (so 1 - Reading, 1 - Watching, 1 - Playing for different kinds of media), and I'd rather have values like 1, 2, 3 to allow sorting (since I think manual sorting isn't supported, please correct me if I'm wrong!) but change their display name so that I can see Reading in my library base, Watching in my TV shows one, and so on. Is that possible? If not natively, does anyone know of a plugin that could make that work? Thanks a lot in advance! EDIT: Can't edit the title, but it should say "property values" instead of "property". Sorry!

已收录讨论

6 条评论

u/witchlinx

I don't think you can edit the property value itself (since that's part of the individual note /.md file) but you should be able to create a base formula that outputs a specific value depending on the property value of the actual proper? So imho you should be able to create a base formula that spits out 1 if the status property contains 1 (or is exactly one of your predefined property values).

u/pyrpyrosOP

Thank you for your reply :) I actually meant having only "1" as the actual property value (instead of all the duplicates I have now) but then having "Reading" show up in a bases view, for example. Is that possible with formulas?

u/witchlinx

Ah sorry I misunderstood! But that would work the same! Just make a formula that reads your status property and then check the context and output your desired string. So as the other commenter above said, use if/else to check for e.g. 1 and then output "reading" or "watching" - use nested if/elses or and functions to combine logic like "if status = 1 and type = book" to then output "reading" and "if status = 1 and type = TV show" to then output "watching". I'm currently on my phone and can't access my computer with my proper obsidian setup so can't give you the exact formulas but maybe someone else will be able to - or I can have a look later!

u/Ptachlasp

This is the answer -- you can use a formula to parse the first character in a string, in this case the number "1". The slicefunction should work. In your base, go to Properties -> Add Formula and use one of the following: status.slice(0, 1) returns the first character in the value of status number(status.slice(0, 1)) outputs it as a number so you can order them numerically or do calculations with them. That's it. Another things you can do if not all property values start with a numbers is use an if-else function. E.g., if value starts with either "to read" or "to watch", then output "1", and so on for the other levels.

u/Total-Boysenberry-28

For your use case, I'd actually make status use 'Reading', 'Watching' etc. depending on the note type and make a sorting formula that assigns each string value in status a number, and then uses that to sort. Why? Because then you can edit the status through the base. If you make a formula instead of a pure property to display in the base, you won't be able to edit the status from inside the base without toggling the raw property. You also lose the abstraction of having the base do the sorting for you after setting it up instead of choosing a priority number to attach at the start of the status string. Edit: More than that, you can make multiple sorting formula and have flexibility for sorting differently, which you wouldn't if your status property is a static number for sorting.

u/Pale-Initiative2162

this is probably the cleanest workaround until they add native display name support for values