TASK Query stops updating the checkbox status when text field is overwritten, is there a way to fix this?

What I’m trying to do

I’m trying to rewrite the text field in a task query (with FLATTEN ... AS text) to create a grocery list from recipes containing the ingredients, but it seems to break the registerHandler for the checkboxes, or however the setTaskCheckedInFile event gets triggered (according to this. In other words, the checkbox status is not modified in the source file when clicked.

I’ve seen a s similar report on the task query not updating the source file when checking boxer after modifying the text field (Dataviewjs and taskList checking item does not update source when text modified?), only I’m not too familiar with dataviewjs so I’ll ask the question with respect to an example of a standard dataview query looking something like this:

TASK
FROM #Recipes
WHERE !completed
FLATTEN  Ingredient + ": " + Quantity + "g" AS text

Assuming all items have a valid field Ingredient and Quantity, which is the case in my vault.

Things I have tried

The order of the where clause (before or after the flatten) does not matter either.

TASK
FROM #Recipes
FLATTEN  Ingredient + ": " + Quantity + "g" AS text
WHERE !completed

I’ve tried to create a dataviewjs query by hacking my way to something working inspired by this example but to no avail, as soon as the field is replaced it stops updating the checkboxes.

Can anyone help me with this? Thanks in advance for a hint!

Use FLATTEN ... as visual, not text, to redefine the text of a task.

1 Like

How comes this is not listed in the dataview documentation? How do you know about that feature, is there a place other than the official docs where I could have found this?
Well anyway thank you a lot, this definitely solved my problem!

I think I found it through this forum, but it’s mentioned kind of cryptic on the page about metadata for lists and tasks.

1 Like

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