Update a variable in frontmatter with math and a template prompt

Things I have tried

Button with templater true and an await in there. Both reading through documentation in shabegom/buttons and official templater syntax.
Tried the math type (calculate) in button as well as putting templater true in there

What I’m trying to do

I have a number variable in my frontmatter (let’s say ‘price’) and at some point in time, an update to that number occurs - given to me as a delta.

So I am trying to combine the value in the frontmatter variable with an input I specify.

For instance:

name calculate new price
type line(11) text
action <% await tp.system.prompt("delta") + tp.frontmatter.price %>
replace [11,11]
templater true

I know that button currently has a bug with regards to templater true, but I still wanted to make progress on reading the value from frontmatter and adding it to the awaited value. However, I don’t think this can work. Button does not wait for the await to return before changing back its text.

I’m looking for other ways of doing this. Possibly by replacing values in the current file wholesale, but I do not know how to pass the current file to a new template being executed (which could then easily return the updated lines).

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