Query that write result on current note?

I want to write my query result on current note.

My idea is:

  • I have file that contain a task list
  • I want to extract the task from this file
  • The result of this query must be written in markdown on the note that ran the query

I have the query to extract the task that i want:

TASK FROM "Produttività 🎯/To-Do List 📝"
where (containsword(text, this.file.name[0]) or containsword(text, "sempre")) and priorità = "alta"

I need only the method for write it’s result, i think i have to use dv.query (dataviewjs function) but i spend a long time without getting it to work.

The solution is: IS NOT POSSIBLE TO DO :smiling_face_with_tear:

Link to a discussion that explain why is not possible: (in reality is possible but are very complicated)

As said here, it’s possible. But is a one step way, i.e., once a static results you can’t “update” the query results!

Ok, i’m solved my problem using C programming language (i have not used python because I already knew C and needed a solution pretty quickly).

The program works like this:

For recurring task write task like this: taks text (recurring: 'first_3_characters_of_the_starting_day'to'first_3_characters_of_the_ending_day')

For example:

  • Task One… (recurring: mon_to_sun)
    • sub-tusk one
    • sub-tusk two — it must be empty, it is used to separate the tasks —
  • Task Two… (recurring: mon_to_fri)

if you want the task to be shown every particular day:

  • Task One… (recurring: sun)

This is program variables:

  • const char *weekday[] = {"dayOfWeek1","dayOfWeek2",...} contains the days of the week (change them with those in your language).
  • char today[130] it will contain the file name in this form: weekDay - dd-mm-yyyy
  • char toDoList[] = {""} contains the path of the file with the tasks inside (replace it with your file path).
  • char *buffer = (char *) malloc(sizeof(char)*100); will contain the text (single line) extracted from the tasks file. (you don’t need to change it)
  • char ricorrenza[15] = {""}; it will contain the occurrence of the task (you don’t need to change it)

You need to change:

  • char toDoList[] = {""} contains the path of the file with the tasks inside (replace it with your file path).
  • In line 167 you need to change like this: `sprintf(today,"DESTINATION_FILE_PATH/%s
  • %02d-%02d-%04d.md", weekday[tm.tm_wday], tm.tm_mday, tm.tm_mon + 1,
    tm.tm_year + 1900);`

The program code: Recurring notes Obsidian - Pastebin.com (I didn’t copy and paste it into the post because it’s about 300 lines of code)

You can integrate this program in Obsidian following u/PartTimeCouchPotato istruction:

And then run that script from Obsidian with “obsidian-commander”???

Or highlight the script text, run it (against any language), and display the results in Obsidian???

All roads lead to Obsidian!!!


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