Dataview, Buttons and MetaEdit - How to use one button to update two (or more) YAML fields?

What I’m trying to do

Each of my projects live on a page by itself and I have things like start date, due date, completed date, and status in the YAML header.

I want to create a button that would update the status, and the completed date.
Preferably if it could move my note into another folder as well that would be even better, but I don’t think that’s possible (I’m more than happy to be proven wrong)

Things I have tried

const {update} = this.app.plugins.plugins["metaedit"].api 
const {createButton} = app.plugins.plugins["buttons"] 
dv.el("p", "Status: `$= dv.current().status`") 

createButton({app, el: this.container, args: {name: "completed"}, clickOverride: {click: update, params: ['status', "completed", dv.current().file.path]}})

I currently have a button that can change the status to “completed” but I don’t know how to also make it update the completed_date field.

Can you share the status change button? I have also been looking to do similar things to your request. I’m interested to see if anything comes of this.

my code above is the status change button; it updates the status field to “completed”

you just have to replicate it for each of the different statuses you want to use.

I assume just wrap this in a dataviewjs codeblock?

I’ve had some issues with the Templater plugin lately, but one idea springs to the mind when you request this, and that is to trigger a template doing the updating.

That is, let the button trigger a javascript template, <%* ... >, which does the actual update of the various field. This will kill two birds with one stone; first of all, it’ll allow you to change however many fields you want, and secondly it’ll shorten your code as the script is included in another file.

yes, that’s correct.

interesting suggesting, I would need to think about how to implement that; one of fields that gets updated is also a calculation field.