How would I edit this Obsidian Dataview query to exclude files contained within the "1.…
- User
How would I edit this Obsidian Dataview query to exclude files contained within the "1. Projects/Archived" subfolder?
Code:
TABLE target AS Target FROM "1. Projects" - Assistant
You can exclude files contained within the "1. Projects/Archived" subfolder by adding a
WHEREclause to the query that filters out files with the "Archived" directory in their path. Here's an updated version of the query that does this:TABLE target AS Target FROM "1. Projects" WHERE NOT Path.Contains("Archived")This query uses the
Path.Contains()function to check if the file path contains the string "Archived". If the path does not contain this string, the file will be included in the results.Alternatively, you can also use a
NOT EXISTSclause to exclude files that have a parent directory with the name "Archived". Here's an example of how to do this:TABLE target AS Target FROM "1. Projects" WHERE NOT EXISTS ( SELECT 1 FROM "1. Projects/Archived" WHERE "1. Projects/Archived" IS NOT NULL )This query uses a subquery to check if there is a file with the name "Archived" in the "1. Projects" directory. If such a file exists, the parent directory will be excluded from the results.
Both of these queries will exclude files contained within the "1. Projects/Archived" subfolder, but they do so in different ways. You can choose the approach that best fits your needs.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.