Dataview to manage outlinks

What I’m trying to do

I am trying to make a Table to list all the outlinks (mainly enclosed images) in my notes.
The scope is to verify if the images are still linked and to overview and control all the connections.

Things I have tried

I have tried several solutions (plugins, Dataview codes found on the web) but I didn’t find anything that answer to my request to have a complete list of all my attachments in one “index” note.

I tested several Dataview scripts, but the nearest solutions is the following:

TABLE
file.outlinks AS file,
file.path AS Path,
file.folder AS Folder
FLATTEN file.outlinks as out
WHERE contains(meta(out).path,"/") AND !contains(file.folder, "Zettel docs")
FLATTEN out.link
SORT file.link ASC

This solution has 2 problems:

1)  the columns are not in the right order -> I would like 1st col= folder, 2nd col=file name, 3rd col= link to the image connected. I tried to change their order but I never was able to have folder as first and if I group by folder all the other data disappear.

2 ) the most important problem -> I am not able to have the link to the attachment (outlinks) but I always see the picture I linked in the note rather than his link.

PS I have all the attachments in the folder "images"

What do you suggest to solve?
Thanks

To address the order of columns I think you can just do TABLE WITHOUT ID to get rid of the erroneous first column (in your case). I’m a little unsure on what you want out of “to have the link”, but doing meta(out) reveals all relevant information without actually linking the image.

So try the following query and see if that helps you somehow:

```dataview
TABLE WITHOUT ID
  file.folder as folder, 
  file.link as file, 
  meta(out).path, 
  meta(out)
FLATTEN file.outlinks as out
WHERE contains(meta(out).path, "/") and meta(out).embed
SORT file.link
```

Remove columns you don’t want and adapt to your liking. Notice how you can use meta(out).embed to verify that the outlink is an actually embed. It should most likely also be refined to have an image file extension or something like that.

Ohh fantastic, you’re great !!

Think that even AI Chat GPT4.0 had not been able to solve it!.

thanks a lot

Do you suggest some place where it is possible to study/find examples of this type? thanks again.

I sincerely hope you’re remark here is sarcastic. Chat GPT is not a source I would trust or rely upon, nor use for creating code.

I’m mainly learned this stuff myself, but I do have a major in computer science as background, which I reckon most people don’t have. However, lurking in the forum and learning to search for answers can be very helpful. There is also a dataview example vault which holds a lot of examples of both data structures and queries to use. Not sure how updated it is to recent changes, but it’ll still be a good resource for learning the ropes.

Yes, sarcastic, to reiterate how useless it is to turn to these AI.
Unfortunately, so do many students.
Thanks again, also for the advice

2 Likes

Just out of curiosity: according your knowledge there is easy method to highlight the “true” values in the results of meta(out).embed?

Something like this?