Using Dataview and to run icontains wherein Note title populates automatically from Templates

Things I have tried

I’d like to create a template (including dataview)

LIST FROM ""
WHERE icontains(Company, [[Note Title]]) AND icontains(Tag,"Personal Contact")

I want to insert this template into a note and the [[Note Title]] will automatically populate in the note WHERE clause with out me having to literally type it each time. Can I have a link as a value? if so, what’s the proper syntax to have it auto-populate? “Company” is a YAML Header and the values (links) would be diff companies that I have an existing note for e.g. [[Amazon]], [[Office Depot]], etc.

I’ve tried:

WHERE icontains(Company,[[{{title}}]])
WHERE icontains(Company,"{{title}}")
WHERE icontains(Company,file.name)
WHERE icontains(Company,file.link)

and none of the above works. The only thing that works is if I manually type the link:
WHERE icontains(Company, [[Amazon]])

However; I have hundreds of Notes for Companies and don’t want to have to insert the company name after I insert the template at the top.

What I’m trying to do

Hi.
For this case you don’t need Templates or Templater.
Just type this:

```dataview
LIST FROM ""
WHERE icontains(Company, this.file.link) AND icontains(Tag,"Personal Contact")
```

Perfect! Didn’t know about prefaces (this) to implicit metadata

Hi @mnvwvnm - is there documentation showing all the prefaces (*.file.link) available?

I don’t understand the question.
All prefixes similar to this? (only this for current note, not others prefixes… )
Or all implicit page metadata?
https://blacksmithgu.github.io/obsidian-dataview/data-annotation/#implicit-fields

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