Combining fields in dataview query

After digging into documentation more and playing around a bit, I found a way to hack something together that works:

TABLE split(join(list(movie, show)), ", ") as “Watched”
FROM #entertainment

In this query,

  • list(movie, show) creates a list of lists
  • join(list(movie, show)) converts the list of lists into a single string where each entry in list(movie, show) is separated by the string ", "
  • split(join(list(movie, show)), ", ") converts that string into a single list

So, that works, but it also feels like a bit of a clunky workaround. For my own knowledge, is there a more elegant in-built way to do this sort of thing?

edit: in particular, what would be handy would be a function that just appends items to a list, or concatenates lists. e.g. if list1 = [a, b] and list2 = [c, d], some function F where F(list1, list2) would return [a, b, c, d]. I don’t see anything like this in the dataview documentation. The closest thing is the list function, but when given lists as input it creates lists of lists instead of a single concatenated list. e.g. list(list1, list2) gives [ [a, b], [c, d] ]

1 Like