obsidian-dataview
obsidian-dataview copied to clipboard
Flatten doesn't work as expected
I thought that we could have a comma separated list of values for a key, e.g., somelist:: item 1, item 2
. If that's true, then there is an issue with flatten.
Flatten does not work when
- an inline key has multiple comma-separated values, eg,
lists:: item 1, item 2
; - the set of values are in square brackets e.g.,
lists:: [item 1, item 2]
It only works when the set of values are
- within dbl quotes, e.g.,
lists:: "item 1", "item 2"
or - wiki links:
lists:: [[oscars 2021]], [[Costume Design]]
or - are in yaml frontmatter as
lists:
- item 1
- item 2
This is due to how inline fields are parsed rather than an issue with FLATTEN
- something like Quote:: Quoth the raven, he is dead
is ambigious in that it could be parsed as a single saying OR as two elements. I went for the "parse as a single string unless it is clearly something else", so for arbitrary strings it only recognizes them as a comma-separated list if they are surrounded in quotes.
Ok. Thanks for the explanation. I would have preferred the opposite, such that if a string includes an odd character like a comma it has to go between quotation marks, as this seems to be more inline with yaml (although I could be wrong about that), and it seems to me that there will more cases of multiple comma separated items as values than longer phrases that include a comma. Of course, that is your decision.
@filmgal this behavior is unlikely to change and you'll have to stick with the double quoting. Shall I close this?
I'm closing this as not planned but please reopen if necessary.