Bases: Find linked yet not created files

What I’m trying to do

I’m trying to recreate the functionality of this Dataview code to find files that have been linked to but not yet created.

TABLE without id 
out AS "Uncreated files", file.link as "Origin"
FLATTEN file.outlinks as out
WHERE contains(file.path, "Notes") AND !(out.file) AND !contains(meta(out).path, "/") 
SORT out ASC
limit 5

Things I have tried

I’m close with this code but looking for “/” isn’t quite working because I get false positives.

formulas:
  Untitled: ""
views:
  - type: table
    name: Default view
    filters:
      and:
        - '!file.links.contains("/")'
        - "!file.links.isEmpty()"
    order:
      - file.name
      - file. Links
    limit: 10

I think it is because I’m not actually looking at the path to the note and only looking at the text such that [[mynote]] would be returned no matter whether it exists or not.

It’s not an exact recreation, but this base would list linked nonexistent notes:

```base
formulas:
  Untitled: file.links.filter(!value.asFile().isTruthy())
properties:
  file.name:
    displayName: Origin
  formula.Untitled:
    displayName: Uncreated files
views:
  - type: table
    name: Table
    filters:
      and:
        - file.links.filter(!value.asFile().isTruthy())
    order:
      - formula.Untitled
      - file.name

```

I think you won’t be able give each uncreated note it’s own row, because Bases rows are existing files.

2 Likes

Thanks a ton! That looks to be exactly what I was looking for. Nice to have the example code as well because that will help me learn more. Especially where you created the formula.

1 Like