Im’ trying to make a table that shows my tasks, where I can see both prioritation, due date, etc. And can filter for this weeks tasks.
Things I have tried
With the help from google and this forum I have gotten to this query, and it kind of works,
but there are som weird question marks, and I can’t seem to figure out how to filter for this weeks tasks only:
```dataview
TABLE without id
regexreplace(Tasks.text, "[⏫🔼🔽]? \[.*$", "") AS Task,
regexreplace(Tasks.text, "[^⏫🔼🔽]", "") AS "Priority",
Tasks.due AS "Due Date",
Tasks.scheduled as "Scheduled", regexreplace(Tasks.subtasks.text, "\[.*$", "") AS Subtasks,
file.link AS "File"
FLATTEN file.tasks AS Tasks
WHERE file.tasks and !Tasks.completed
Where Tasks.due
SORT Tasks.due asc
```
Dataview has expressions you can use for comparing dates: Literals - Dataview
One of them is for the start of the current week date(sow) and another is for the end of the week date(eow). So you could filter for due dates that are between those two, inclusive of either the start or end, depending on which you want. Like this:
WHERE date(sow) <= date(Tasks.due) AND date(Tasks.due) < date(eow)
Since your WHERE statements are back to back and you already flattened file.tasks before your WHERE statements, you can combine and reduce them to just this line:
WHERE !Tasks.completed AND Tasks.due AND date(sow) <= date(Tasks.due) AND date(Tasks.due) < date(eow)
It appears as if you’re getting one question mark per and icon. And perhaps other icons. If you have this task:
- [ ] task 1 📅 [due::2025-04-22] 🔼 📥
… does the priority show “� �”? Then paste “” into the task to see if you get three more question marks.
If that’s the case, then someone who knows more than me about regex and/or icons in Dataview might be able to figure out a solution for that. Maybe get those folks’ attention with a forum post title about specifically that.
The emoji is from the task plugin itself, so I can’t filter those out, unless I change the style of my tasks from the emoji style to the dataview style, and i would prefer not to. I didn’t get any further from the other post, unfortunately
Oh. I was talking about updating the title (which I see you’ve done now) not reposting.
I don’t use Tasks so can’t test, but since that regex statement isn’t replacing all icons, then use a different method. You can try this one with choice:
```dataview
TABLE WITHOUT ID
regexreplace(Tasks.text, "[⏫🔼🔽]? \[.*$", "") AS "Task",
choice(contains(Tasks.text, "⏫"), "⏫", choice(contains(Tasks.text, "🔼"), "🔼", choice(contains(Tasks.text, "🔽"), "🔽", ""))) AS "Priority",
Tasks.due AS "Due Date",
Tasks.scheduled AS "Scheduled",
regexreplace(Tasks.subtasks.text, "\[.*$", "") AS "Subtasks",
file.link AS "File"
FLATTEN file.tasks AS Tasks
WHERE !Tasks.completed AND Tasks.due AND date(sow) <= date(Tasks.due) AND date(Tasks.due) < date(eow)
SORT Tasks.due ASC
```
Wuuaw you are a genius. I had tried with choice but gave up . Amazing! Thank you so much. Now is it possible to have clickable checkboxes in this table too? Sorry to pick your brain but you seem very skilled.
As far as I know, a Dataview TABLE query cannot do that. A clickable checkbox would manipulate the content of the file that has the task, and a TABLE query doesn’t let you to manipulate files. It just reads files.
A TASK query will give you the checkboxes but not your columns.
When you’re using [abc] it matches against any of those single characters, a, b or c. This also holds true if you’re using the same construct but list multibyte characters like many of the emoji characters. Imagine that you do [&C&D] where &C and &D are two multibyte characters shiwn as one entity like an emoji. When this is replaced as single characters, you’ll end up with some strange encoding which would display as question marks.
This can be countered in two ways. Either one would need to pass flags to the regex engine telling it to properly use multibyte characters, or one could use alternate group matching. The first is not a common way to do regex (still) and would break many older regex patterns.
The second one should be doable using something like (&C|&D) instead of the character class you used before. (Untested variant, but you get the first of it. You might also want to look into adding some options to make it a non-capturing group.
holroy, wow. I saw their results and just thought, “emojis and regex be weird like that”, and fleetingly thought, “maybe a non-capturing group instead”, but didn’t really know why or if it would make a difference. So I didn’t bother trying to fix it. Your explanation has it making sense now. Thanks.