Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omit "File" column in TABLE results #102

Closed
joerncodes opened this issue Apr 14, 2021 · 16 comments
Closed

Omit "File" column in TABLE results #102

joerncodes opened this issue Apr 14, 2021 · 16 comments
Milestone

Comments

@joerncodes
Copy link

@joerncodes joerncodes commented Apr 14, 2021

As the title said, I would love a way to omit the "File" column in the result of a TABLE query.

My notes tend to have pretty long and complex names, and I'd love to use a shorter YAML field to link to the file instead. I would be delighted if there was an option to hide the "File" column.

@blacksmithgu
Copy link
Owner

@blacksmithgu blacksmithgu commented Apr 16, 2021

I will add a quick-fix hack for this by allowing you to write

TABLE field AS File, ...

which will render field in place of 'File'. In the long run, I will add a configuration option for it.

@joerncodes
Copy link
Author

@joerncodes joerncodes commented Apr 16, 2021

That works for me!

@SkepticMystic
Copy link
Contributor

@SkepticMystic SkepticMystic commented Apr 16, 2021

An immediate workaround is to group by a unique field. So this codeblock groups by file.name, then returns the title yaml field of each group. But since the group condition is unique, it just displays each note's field, and doesn't display the first column.

table rows.title as Title
from #SN
group by file.name

@joerncodes
Copy link
Author

@joerncodes joerncodes commented Apr 16, 2021

That's true, the problem I had with that is that this doesn't work:

table rows.icon + " " + rows.title as Title from #SN group by file.name

@SkepticMystic
Copy link
Contributor

@SkepticMystic SkepticMystic commented Apr 16, 2021

You get something like this, right?
image

I think I've posted an issue related to this.

@joerncodes
Copy link
Author

@joerncodes joerncodes commented Apr 16, 2021

Correct!

@stevelr
Copy link

@stevelr stevelr commented May 4, 2021

I ran into this problem also, and one thing that was confusing was that in example on the obsidian-dataview README, the File name has the column Name, not File, and I don't see anything in the documentation explaining how to rename it.

I will add a quick-fix hack for this by allowing you to write

TABLE field AS File, ...

which will render field in place of 'File'. In the long run, I will add a configuration option for it.

One issue with this proposed solution is that it doesn't allow naming the column, for example, if the field is "name" and I want the column heading to be "Name".

My preferred fix would be to find a way to disable the column entirely. Then any field, with any heading, could be in the first column, and if we still want a file name, we can add file.name to any column.

@rxian
Copy link

@rxian rxian commented May 9, 2021

It appears that we now have full control over which columns to display with dataviewjs in the recent release.

@calpa
Copy link

@calpa calpa commented May 10, 2021

I think there should be an option to toggle whether show the File column or not.

@steve-bate
Copy link

@steve-bate steve-bate commented Jun 11, 2021

@rxian Can you point to the documentation for that? I looked but couldn't find it. Thanks.

@rxian
Copy link

@rxian rxian commented Jun 11, 2021

@rxian Can you point to the documentation for that? I looked but couldn't find it. Thanks.

Its the Dataview JavaScript API: https://blacksmithgu.github.io/obsidian-dataview/docs/api/intro

@M-bot M-bot changed the title feature request: Omit "File" column in TABLE results Omit "File" column in TABLE results Jul 22, 2021
@blacksmithgu
Copy link
Owner

@blacksmithgu blacksmithgu commented Jul 30, 2021

This is now possible via

TABLE WITHOUT ID ... FROM
...

@blacksmithgu blacksmithgu added this to the 0.4.3 milestone Jul 30, 2021
@robmiller
Copy link

@robmiller robmiller commented Aug 15, 2021

For anyone else who was, like me, looking for the "rename the File column" use-case here rather than the "omit the File column" one, the change committed in this issue does also allow you to do that. You just need to add a column that displays file.link:

TABLE WITHOUT ID
  file.link AS "Some other name",
  foo AS "Foo"
FROM #bar

@bodiequirk
Copy link

@bodiequirk bodiequirk commented Oct 29, 2021

@robmiller Thank you!! This is exactly what I was looking to do. The "File" title was truly annoying as a default, so thanks for the workaround.

@blacksmithgu
Copy link
Owner

@blacksmithgu blacksmithgu commented Oct 30, 2021

You can also change the default "File" title in the Dataview settings.

@maia-sh
Copy link

@maia-sh maia-sh commented Jan 22, 2022

Building on @robmiller's comment, in case this of use to anyone else, here's a snippet to keep the file link but change display text to another the values of another column (title):

TABLE WITHOUT ID
  link(file.link, title) AS "Title",
  foo AS "Foo"
FROM #bar

Or an implicit field:

TABLE WITHOUT ID
  link(file.link, file.path) AS "File Path",
  foo AS "Foo"
FROM #bar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
10 participants