obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

Flatten doesn't work as expected

Open filmgal opened this issue 3 years ago • 3 comments

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

  1. an inline key has multiple comma-separated values, eg, lists:: item 1, item 2;
  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

  1. within dbl quotes, e.g.,lists:: "item 1", "item 2" or
  2. wiki links: lists:: [[oscars 2021]], [[Costume Design]] or
  3. are in yaml frontmatter as lists:
    • item 1
    • item 2

20210509_171956

filmgal avatar May 09 '21 21:05 filmgal

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.

blacksmithgu avatar May 13 '21 00:05 blacksmithgu

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 avatar May 13 '21 01:05 filmgal

@filmgal this behavior is unlikely to change and you'll have to stick with the double quoting. Shall I close this?

AB1908 avatar Jul 29 '22 07:07 AB1908

I'm closing this as not planned but please reopen if necessary.

AB1908 avatar Oct 29 '22 20:10 AB1908