obsidian-dataview
obsidian-dataview copied to clipboard
Empty value in bracketed inline data overwriting default value in table
What happened?
This error occurred on both deesktop & mobile versions of Obsidian
Frontmatter & unbracketed key-value pairs performed as expected, however an empty bracketed inline data overwrites a table's default value with blank. Screenshot of source & preview mode attached.
issue can be recreated :
Test1:
Test2:: [Test3::]
DQL
Table
default(Test1, "👽") AS "1",
default(Test2, "🛸") AS "2",
default(Test3, "🐮") AS "3"
WHERE Type = "Test"
JS
No response
Dataview Version
0.4.26
Obsidian Version
0.13.33
OS
Windows
- A value in Test3 renders properly in the DV Table
In Discord, was asked to also run ' = this` query. Results attached
Also, was asked to reassign issue to @AB1908 but I can't seem to find a way to do that (using mobile GitHub)
Test1
and Test2
evaluate to undefined
and null
. Test2
is not indexed at all as you can see here:
default
, per the docs, changes default values for values that are null
, and also appears to work for undefined
. However, Test3
has an empty string ""
, which is not null, which is why the field is not populating as you expect it to.
Ah that makes sense now! I didn't realize the brackets would automatically make it a blank string, whereas the other formats don't.
Thank you for your help!!
Admittedly I was using the brackets primarily just to be able to target the data with CSS. Is there a way to target the Test2 format? If not, I totally understand, styling kind of goes beyond the point of reading & working with raw data.
I'm not aware of how to apply CSS to inline fields. Let me poke around and get back to you.
Sorry for the late check on this but any progress? I would appreciate a check since there have been some improvements to the parser. If not, I'll dig it up again.
Hello, sorry to come back to you so late. I currently go through older issues to see which are stale or already solved.
Theres a FR in #713 to be able to style non-bracketed inline fields. If I get you right, that's what you want to have? If this is the only open point on this issue and if it's okay, I'd like to close the issue in favor or #713.
That the bracketed inline field is set to an empty string as value is intended behaviour, as far as I can tell - in fact, it is the only way I am aware of to use an empty value.