Dataview table filename shorten?

Hi,
does anyone know if the can shorten the filename from dataview?

I have a table and the first thing is unfortunately the filenames I have made them too long with names chapters etc. that has not been so nice ;-(

if i now output the table with name, alias it is confusing

I would like to shorten only the filenames?
is it possible with dataview?

1 Like

Hi @xverbatim_1977 , I’m not sure if this is quite what you mean, but you can eliminate the file column entirely by using WITHOUT ID, e.g.

```dataview
TABLE WITHOUT ID
  Field1, Field2
FROM "Folder"
```
1 Like

hi,
first of all thank you.
the tip is already good.
the problem is only that I do not have the links then and can call?
so it must somehow go, that one shortens the names?

Hmm, that’s a little tricker, since it sounds like you want to shorten the name but still keep the link clickable. So we need to use FLATTEN and truncate() to construct a link to the page with a shortened name, say 20 characters:

```dataview
TABLE WITHOUT ID
	Link,
	file.mday as Modified
From "Notes"
FLATTEN "[[" + file.path + "|" + truncate(file.name, 20) + "]]" as Link
LIMIT 15
```

Here’s what this query looks like in my vault:

You can change the 20 in the truncate() function to however many characters you like. And of course the LIMIT 15 is just to keep it short; you may want to remove that line for your vault.

2 Likes

Perfect :pray: :grinning: :smiley: :smile:

Thank you!!!

i have adapted the solution like this… it works great

```dataview
TABLE WITHOUT ID
Link as "➡️",
alias as "Kapitel"
From "100 Fernlehrgang Pflegeberatung/Lernhefte" and -"Templates"  
FLATTEN "[[" + file.path + "|" + truncate(file.name, 8) + "]]" as Link
where contains(type, "Lernheft") 
1 Like

If both allow my “input”, I just want to make two suggestions:
1 - best structured way to do this is with an alias field in each file, where you define the short file name;
2 - to @Craig solution I just add another “variant” without the concatenation way:

TABLE WITHOUT ID
     link(file.link, short) AS "File"
FROM "your-folder-path"
FLATTEN truncate(file.name, 10) AS short
3 Likes

Oh, that’s great, I love using the link() function there. Much more readable! :+1:

1 Like