blacksmithgu / obsidian-dataview

A data index and query language over Markdown files, for https://obsidian.md/.
https://blacksmithgu.github.io/obsidian-dataview/
MIT License
7.04k stars 413 forks source link

Bug report - Group By folder name #978

Open mrwhaler opened 2 years ago

mrwhaler commented 2 years ago

What happened?

Dataview: Every row during final data extraction failed with an error; first 3:

            - Cannot call type 'array' as a function
- Cannot call type 'array' as a function

DQL

TABLE 
rows.file.aliases AS Aliase,

> rows.link(file.link, file.aliases) AS Link

GROUP BY file.folder

JS

No response

Dataview Version

0.4.26

Obsidian Version

0.14.2

OS

Windows

blacksmithgu commented 2 years ago

It's just link:

TABLE row.file.aliases AS "Aliases",
link(file.link, file.aliases) AS Link,
GROUP BY file.folder
mrwhaler commented 2 years ago

изображение

TABLE 
link(file.link, file.aliases) AS Link
GROUP BY file.folder

Grouping does not display anything

AB1908 commented 2 years ago

Can you show us what the output of this query is? Full output won't be necessary and feel free to strip out sensitive info.

```dataview
table 
  file.folder
```
mrwhaler commented 2 years ago

изображение изображение

I will explain what I want to do. I need a list (rows) where the name of the link is replaced (by another value) and it can be grouped.

I imagined it like this: rows.link(file.link, file.aliases) AS Link

AB1908 commented 2 years ago
table without id
  link(rows.file.path, rows.file.aliases) as Link,
  rows.file.name
from "Folder"
group by file.aliases

Note that all files without aliases will be grouped together.

mrwhaler commented 2 years ago

Is there an opportunity to make grouping on folders (first column) and change the name of the link to the file with its pseudular (second column)?

| Folders Group | Link (file.link as aliases) |
| ------------- | --------------------------- |
| /folder/      | - 1                         |
|               | - 2                         |
|               | - 3                         |
|               | - 4                         |
|               | - 5                         |
| ---           | ---                         |
| /folder2/     | - 6                         |
|               | - 7                         |
|               | - 8                         |
|               | - 9                         |
|               | - 10                        | 
mnvwvnm commented 2 years ago

For the next query, two prior conditions:

  1. always a defined alias;
  2. only one alias.
TABLE rows.LK as Link
FLATTEN link(file.link, file.aliases) AS LK
GROUP BY file.folder
mrwhaler commented 2 years ago

Please explain the meaning of the "Flatten" operator

AB1908 commented 2 years ago

Separates a result having multiple results in a cell (as a list) into separate entries. https://blacksmithgu.github.io/obsidian-dataview/query/queries/#flatten

AB1908 commented 2 years ago

Hi, is this still an issue?