Is it possible to create a new file and then modify the annotated data?


I’m new to Obsidian and I’m trying to create a really simple script based on templater + dataview + buttons plugins.

The intention of the Script is to generate a Note “B” (applying a specific template) from note “A” when clicking on the button that triggers the script.

But there is a catch.

I want to populate the dataview annotated fields of Note “B” based on the daview annotated fields from Note “A”.

Here is an Example:

Note A (Country):

world:: [[Earth]]
#Example Title
Lots of stuff

Note B (Animal) Template:

#Example Title
Lots of stuff

When creating the Note B from the button allocated in Note A, I want to populate the world:: field with [[Earth]] value because the father has this value.

Investigation Notes/Questions:

  • I know read that dataview API is read-only so you can’t modify the annotated fields through this plugin (Right, I’m not 100% sure?)
  • Is there any way to get the tp variable from a newly created file (created using tp.file.create_new() function)? Because if I can do that from a JS Script it will solve all my problems

I appreciate any help, this is driving me a little bit crazy… hehe