Open shtu-cham opened 3 years ago
The WITHOUT ID
grammar is to get rid of the hard-coded "File" field if you want to use something else, it's not a filter operator.
If you want to filter, you probably want the filter
function:
TABLE filter(file.inlinks, (l) => l != [[Link To MOC]]) AS "Links", ...
The
WITHOUT ID
grammar is to get rid of the hard-coded "File" field if you want to use something else, it's not a filter operator.If you want to filter, you probably want the
filter
function:TABLE filter(file.inlinks, (l) => l != [[Link To MOC]]) AS "Links", ...
Thank you for your reply. Yes, I might want this. To be specified, I just want to control the content of table. Like I said before, in order to realize the connection of each file, I would love to do it with the help of dv. However, if all the files are connected to the MOC, and the filter might filter everything, then I won't see anything from the table. So I just need to let the MOC don't show up in file.inlink column.
Furthermore, when I insert a picture in the file, the name of the png will show up in the outlink column too. To focus on the link between points, I also want to exclude this kind of information.
Thank you for your hard work!
I'm not fully understanding what you are looking for. The brief example I gave will, for each file, list all of it's incoming links except a specific MOC. Is it not giving the output you want?
Image links showing up in file.outlinks
is a bug; I will fix it for the next release.
I'm not fully understanding what you are looking for. The brief example I gave will, for each file, list all of it's incoming links except a specific MOC. Is it not giving the output you want?
Image links showing up in
file.outlinks
is a bug; I will fix it for the next release.
Emm, sorry to bother you. I did copy the code to my ob, and changed the content of [[Link to MOC]] to the name of my MOC. Still the MOC will appear in my file.inlink column. Did I use it in the wrong way? Thank you for your patience.
Can you share the exact query you are using? I was able to filter out the MOC when I tried doing this locally, so it may be a difference in our queries.
Can you share the exact query you are using? I was able to filter out the MOC when I tried doing this locally, so it may be a difference in our queries.
I called it SoilMachinicsMOC. So I use the code below.
dataview TABLE filter(file.inlinks, (l) => l != [[SoilMachinicsMOC]]) AS "Links",title,tags,aliases,file.inlinks,file.outlinks,file.link from "Soil" where contains(tags,"Machinics")
Though, it still show up in table.
You have file.inlinks
in the table twice - once as the filtered column ("Links"), and then again later on without the filter. Is there a reason for having both? You should only need the first one.
For context, filter
only affects the value you are filtering, not other columns. So
TABLE filter(file.inlinks, (l) => l != [[Link]]), file.inlinks
Will only filter the first column, not the second one.
For context,
filter
only affects the value you are filtering, not other columns. SoTABLE filter(file.inlinks, (l) => l != [[Link]]), file.inlinks
Will only filter the first column, not the second one.
Thank you, now I see the way of using it. According to your guide, I rewrite it below, put the file.inlinks column to the fourth.
TABLE
title,tags,aliases,filter(file.inlinks, (4)=>4 != [[SoilMachinicsMOC]]) AS "Links",file.outlinks,file.link
from "Soil"
where contains(tags,"Machinics")
Then it comes back to me with error.
Expected one of the following: '(', 'null', boolean, date, duration, file link, list ('[1, 2, 3]'), negated field, number, object ('{ a: 1, b: 2 }'), string, variable
Could you please help with this error? Much appreciate it!
This is a little advanced, which is why it may be confusing - the error is in the 4
; instead of 4
, use x
(the thing you replaced with 4 is a variable, which cannot start with a number).
TABLE
title,tags,aliases,filter(file.inlinks, (x)=>x != [[SoilMachinicsMOC]]) AS "Links",file.outlinks,file.link
from "Soil"
where contains(tags,"Machinics")
This is a little advanced, which is why it may be confusing - the error is in the
4
; instead of4
, usex
(the thing you replaced with 4 is a variable, which cannot start with a number).TABLE title,tags,aliases,filter(file.inlinks, (x)=>x != [[SoilMachinicsMOC]]) AS "Links",file.outlinks,file.link from "Soil" where contains(tags,"Machinics")
Thank you, now I correct my dataview code and it works! I noticed dataview was updated to 0.4.8, yet the name of the png still show up in the outlink column. I am looking forward to seeing it fixed.
Again, thank you for your amazing work!
I'd love if we get .file.allOutlinks
that also include dangling links and images and web links, and then the old .file.outlinks
that are just the regular wikilinks to files.
This quirk bit me in the butt today when I tried to do an outlinks.every(l => dv.page(l.path))
Hello,
The file.outlinks is still showing links to attached documents (images, email...) and not only between .md files, is it still planned to correct it ? Or is there a new outlinks metadata to exclude it ?
Thanks !
I'm not fully understanding what you are looking for. The brief example I gave will, for each file, list all of it's incoming links except a specific MOC. Is it not giving the output you want?
Image links showing up in
file.outlinks
is a bug; I will fix it for the next release.
Hi!
It seems they're still there (or maybe again?). I tried to filter them out using
filter(file.outlinks, (x) => !contains(x,".png"))
That didn't work either. Any idea welcome.
I'm not fully understanding what you are looking for. The brief example I gave will, for each file, list all of it's incoming links except a specific MOC. Is it not giving the output you want? Image links showing up in
file.outlinks
is a bug; I will fix it for the next release.Hi!
It seems they're still there (or maybe again?). I tried to filter them out using
filter(file.outlinks, (x) => !contains(x,".png"))
That didn't work either. Any idea welcome.
Hey!
I got i working with filter(file.outlinks, (x) => !contains(string(x), "png"))
Hope that helps!
How to write filter(file.outlinks, (x) => !contains(string(x), "png"))
for dataviewjs?
I tried:
dv.filter(dv.current().file.outlinks, (x) => !contains(string(x), "png"))
shows error: TypeError: dv.filter is not a function
And I can't see a documentation on filter in dataviewjs... where can I find that?
dv.current().file.outlinks.where(x => !x.path.endsWith("png"))
dv.current().file.outlinks.where(x => !x.path.endsWith("png"))
Thank you @AB1908! that worked!
Hey, btw, is there a documentation for these codes? Like, where did you find the path.endsWith()
function? I am a bit new to this so don't really know where to look. Would appreciate the guidance ^^
That's just regular javascript. Use MDN. Also, toying around in the developer console is supremely helpful.
dv.current().file.outlinks.where(x => !x.path.endsWith("png"))
sorry guys, i'm pretty new to all the languages that are used in Obsidian. How do i use this snippet?
this is my Querry so far:
TABLE WITHOUT ID
file.link AS "Dateiname", dateformat(file.mtime, "HH:mm D") AS "Bearbeitet", file.outlinks AS "Linkt zu"
WHERE !contains(file.outlink, ".png")
SORT
file.mtime desc
"WHERE !contains(file.outlink, ".png")" does not work atm.
I'm a little confused, how is showing links to images in queries a bug? If I linked to an image, it should show up in links.
Did you mean embedded images are showing up as links?
Is your feature request related to a problem? Please describe. I would use without grammar in any other columns, but the only way I found to use the without method was for ID. For example, I am writing notes with the help of obsidian and dataview. During this process, when I am writing notes, also using dataview to generate my MOC table, so I will take file.inlink and outlink into consideration. While I try to do that, I notice that the MOC appears in each file.inlink rows, so I want to exclude it.
Describe the solution you'd like Provide the without grammar support for it, then I can append it in my dataview code.
Describe alternatives you've considered Provide the filter which allows people freely filter the elements they don't want.
Additional context