Listing the dataview in-line field as a link author:: [[[[Name Surname]]

What I’m trying to do

I try to list all the notes with a specific author, using in-line field author:: Name Surname and author:: [[Name Surname]].

TABLE file.mtime as Edit FROM -#Task AND -"DailyNotes"  WHERE author = "Name Surname" OR author = "[[Name Surname]]"SORT file.mtime asc

The issue is the files with author:: [[Name Surname]] are not listed.

Things I have tried

I have searching the forum for hours, I am sure this answer exists somewhere but I cannot find it.

Try with that:

WHERE contains(string(author), "Name Surname") 
2 Likes

Thank you so much!!!

Note that this work by forcing the output of both the string, “Some name”, and of a link, “[[Some name]]” into their respective text values. If you are to add multiple values or aliases to your author field, you could run into some issues or strangeness.

Another way, which is way more complicated would be to use a combination of choice(), typeof() and meta(author), which all have their merits in different circumstances, but if the string(author) ticks all your boxes, and you’re not too worried about side effect, do use it.

The basic sketch of the alternative would be something like:

WHERE contains(choice( typeof(author) = "link", meta(author).display, author), "Name Surname")

And this still doesn’t account for multiple values, where you could do an outer variant of choice() with typeof() to check if it’s an array. This could possibly also need to use any() somewhere in the mix, and map()

Just leaving this here for reference, in case you should run into some anomalies, side effect, issue related to using the simpler string(author) variation. It should work nicely in most cases, but I’m too used to accounting for those side effects, and rand cases.

1 Like

Thx olroy.

Holroy give you a “better” script.
U can find the documentation here:
https://blacksmithgu.github.io/obsidian-dataview/reference/functions/#choicebool-left-right

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.