Skip to content

Filter to show tasks for files that contain certain tags or files that have certain backliknks #2458

Answered by mikejlaurie
mikejlaurie asked this question in Q&A
Discussion options

You must be logged in to vote

thanks so much for the links, I manage to get it working!

/*
    PURPOSE: Tasks query that shows all  open tasks that are existing in pages which link to another page. Useful if you use Page links instead of tags  in obsidian
*/

let paths =dv.pagePaths("[[Page to link to ]]")
const pathFilters = paths.map((path) => `( path includes ${path} )`);
// Join the Tasks path filters in to a Boolean OR query.
let filterForOutlinks = pathFilters.join(' OR \\\n');

// Construct the Tasks query string:
const tasksQuery = `
    # Note that as of Tasks 5.0.0, this search will fail if any
    # of the outlinks have a ( or ) anywhere in their paths:
    ${filterForOutlinks}
    not done
    group by fil…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@claremacrae
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by claremacrae
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
scope: filters Additions and modifications to the search filters
2 participants