Dataview - Combining Task query w/ regex

I am using the KANBAN plugin and utilize dataview to pull all those tasks into a list which I display in the sidebar to have them in view all the time. The problem is that dataview also shows the due date set by the Kanban plugin which I’d love to cut out by using regexreplace.

This is what my current dataview query code looks like:

TASK 
WHERE !completed
WHERE due
GROUP BY due
SORT due ASC

And this is the result:

Is there some way to fiddle sth like

regexreplace(text, "\@.*$", "")

in there to tidy things up?

1 Like

I can only think of how to do this in dataviewjs. Here’s a translation to dataviewjs of your current query, plus a regex replace added. (Remember to also replace dataview with dataviewjs after the 3-backticks in the first line of your code block!) Linebreaks and spacing optional, here to make it easier to read on the forum.

const result = dv.pages().file.tasks
  .where(t => t.due && !t.completed)
  .sort(t => t.due, "asc")
  .groupBy(t => t.due);
result.forEach(g => g.rows.forEach(t => t.text = t.text.replace(/\@.*$/, "")));
dv.taskList(result);

This is absolutely perfect - thank you very much. :slightly_smiling_face:

Is it also possible to render the checkboxes for subtasks coming from KANBAN or is this a current technical limitation of KANBAN?

1 Like

I don’t know, and I don’t have Kanban, so I can’t test this myself. Can you tell whether anything is odd about the lines where they aren’t rendering?
(e.g. Is there exactly 1 space between the [ and ]? Does the indentation seem right?)

You can comment out or temporarily remove the line that starts result.forEach(... if you want to confirm that the regexreplace didn’t cause this trouble (but I don’t understand how it would)!

If I think of anything else I will come back and edit this. But another place to ask would be the “Discussions” page on the Dataview GitHub - maybe your picture will tell someone more expert than me what the issue is! Good luck!

Just checked myself, found this to be a KANBAN problem. Kanban obviously does not really play ball w/ nested tasks/subtasks in the same card.

left KANBAN, mid KANBAN markdown, right dataviewjs

Will throw this the Kanban devs way, maybe they can figure sth out.

1 Like

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