Tasks Plugin - search by string syntax

What I’m trying to do

Hi all, I’ve recently jumped into the world of Obsidian and am trying to explore the customizable features of the powerful application.

I’m currently working on a template for work. Throughout my day, I will generate a note for every meeting I have. Most of these meetings will generate a task where they will be ‘assigned’ to a member of my team.

What I am looking to do is search through the text description of my tasks for a specific text string.

I would like to take this tasks query and use it in a template created for each member of my team. So, when I open up the note for [[John Doe]] which is formatted with the template including the code, it will automatically reference the text string John Doe and pull the tasks.

So far, I have only been able to make this work by explicitly typing in the string as John Doe.

Things I have tried

So, this is the syntax that has worked.

description includes <string>

I’m using templater and thought maybe this would work, but it doesn’t pull the title as a string to search the tasks descriptions:

description includes <% tp.file.title %>

I also attempted to pull using the {{query.file.path}} or {{query.file.title}} syntax, but this only pulls tasks where linked note for the task includes the file name (example: John Doe)

description includes {{query.file.title}}

I have a feeling I’m just a coding noob here and don’t understand the syntax. Can anyone help me with the correct syntax to pull the note title and use it in a text search of the tasks in my vault? Again, Ideally I want to include this in the template I apply to my notes for contacts or people.

Thanks for your help.

description includes <% tp.file.title %>

Problems can occur when you try to retrieve file title while creating the file. I recommend using Modal forms community plugin for file creation. Then in your code you use modalForm.openForm to access the user input data used to create the file.

from Modal forms README.md:

FormResult Methods

When you open a form, you get back a FormResult object. This object contains the data of the form and some methods to help you process it. This FormResult object returned by the openForm method has several methods that can be used to process the form data. Here is a brief description of each method:

asFrontmatterString()

This method returns the form data as a string that can be used in a frontmatter block. It formats the data in YAML syntax. Here is an example of how to use it:

asDataviewProperties()

This method returns the form data as a string of dataview properties. Each key-value pair in the form data is converted into a string in the format key:: value. Here is an example of how to use it:

getData()

This method returns a copy of the form data. It can be used when you need to manipulate the form data without affecting the original data.

asString(template: string)

This method returns the form data formatted as a string matching the provided template. The template is a string that can contain placeholders in the format {{key}}, which will be replaced with the corresponding value from the form data. Here is an example of how to use it in a templater tempmlate:

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