Evaluation Error: TypeError: row.map is not a function

What I’m trying to do

I’m trying to create a matrix with the unique Map as row and unique Hero as column (+ Map at the start). As values, I want to calculate the win rate of that hero on said map. I’ve attached an image of my file structure. All these files are inside a folder called “Gamestats” next to the file containing the dataviewjs code-block.

Images

image



image

Your pages variables contains the entire page of each file in that given folder. You’ve not declared which part of the page you want to display in the table, and this confuses dataview and it gives a rather cryptic error message like you’ve seen.

You can address this issue in either of two ways:

```dataviewjs
const pages = dataview.pages('"Gamestats"')
  .map(p => [ p.Map, p.Hero, p.Result ])

dataview.table(["Map", "Hero", "Result"], pages)
```

```dataviewjs
const pages = dataview.pages('"Gamestats"')
  
dataview.table(["Map", "Hero", "Result"], pages
  .map(p => [ p.Map, p.Hero, p.Result ]))
```

I’ve used both depending on what other kind of processing I’d like to do on the pages variable before presenting the result. The latter can be very useful if you want to present multiple tables on the same result set.

And for future posts, please post actual code not images of such. This would make it easier for responders to copy your examples and test what’s happening. And if you want to showcase either markdown, or code blocks, or dataview queries properly in a forum post, be sure to add one line before and one life after what you want to present with four backticks, ````. This will ensure that any other backticks (like in code blocks or queries) is properly shown.