Dataview: Map every array field

I have files that combine other files:

# Root A
link:: [[File 1]]
link:: [[File 2]]

Every file contains an emoji icon:

# File 1
icon:: 😊

# File 2
icon:: 😊

What I want is to have the following list (table is good also):

- Root A
  - 😊 [[File 1]]
  - 😊 [[File 2]]
- Root B
  - 😊 [[File 3]]
  - 😊 [[File 4]]

In the example above, I want to β€œlist roots with their links, icons attached”.

I tried to concatenate like this:

list (link.icon + " " + link)

But then realized, that this approach would work with single fields, not with arrays, since I just conactenate a string with an array.

OK, nevermind, I was able to solve it with DQL and the map function:

table map(link, (it) => default(it.icon + " ", "") + it.file.link) as Links where link != null

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.