Im unsure why my dataview query is not returning expected results. Can anyone help?
Context:
I use “#task/project/project_name” to arrange my tasks. I then have an master project task list which filters all project tasks. I group them using high, medium and low priorty (e.g. “#priority/high”).
For the master project tasks tracker, the below code works without issue.
TASK
WHERE contains(lower(text), "#task/project")
AND !completed
AND contains(lower(text), "#priority/high")
GROUP BY file.name
However, if I want to have a project specific task tracker, the code does not return results, e.g. it shows there are 0 tasks for that project under that priority. Example of that code
TASK
WHERE contains(lower(text), "#task/project/projectX")
AND !completed
AND contains(lower(text), "#priority/high")
GROUP BY file.name
In the master project tasks tracker, a high priority task for projectX will show up in the tracker, however in the project specific tasks tracker, this same task does not show up.
Something that could explain why the query doesn’t work for a specific project could be the fact that you lower() the text but not the tag…
I mean, if you lower() the text but use uppercases in your tag, like you did in the example you gave in your post ("#task/project/projectX"), your contains() outputs false and the query is stopped there…
If you lower() the text, you would probably need in that case to lower() the tag within contains() too… or use icontains() to make it case-insensitive (econtains() for an exact case-sensisitve match also exists )
The project names I use are abbreviations (projectX was just an example for this use case) and I used CAPS in the query. Once I changed this to lower case it worked without issue. Great to know and thanks again for you help.