Using Templater, there’s at least 2 ways to fill that parameter.
You could use tp.file.title(true), which gets the relative path to the file as a string.
The other solution would be to use app.workspace.getActiveFile(), which grabs the currently active file as a TFile.

1 Like

Worked like a charm. Thanks, @Christian.

1 Like

Sorry for the very delayed reply, but could you provide some more detail on how you did this? I would love to replicate it for several things!

Specifically, the part I’m not understanding is how you embedded this in your monthly note - where did you save the code, etc.? :slight_smile:


Update: I figured it out! You need to wrap it in a dataviewjs code block:

```dataviewjs
--- code here ---
```

How do I get the attribute called review to grow automatically every time I open a note?

1 Like

@Christian : In the features list is described the possibility to :

Edit last value in tags - works with Obsidian Tracker, too.

But it seems undocumented : could you please add more precisions ?

Thanks !

Most of my YAML meta are lists. How do I enter a new item as a list underneath the previous one. For instance:

Learned today:
- To use metaedit
- To use metaedit to create a list

Right now the way it is coming out is the following

Learned today: To use metaedit to create a list
- To use metaedit 

I’m sure there is a quick fix for this, but I couldn’t find anything.

Thanks!

This requires a listener to the “File opened” event. There might be a good implementation for a new MetaEdit feature that does this, but I’d have to think it through. For now, you could make a simple plugin for Obsidian that listens to that event and then calls the MetaEdit function if the attribute is present. :slight_smile:

Unfortunately, there’s not much in the way of quick fixes. Supporting proper YAML has been on my to-do list for the longest time, so it’s probably the very next thing I’ll do. Only arrays are supported at the moment (e.g., [1, 2, 3]).

Tracker allows you to specify a value after the tag, i.e., #tag:value. So depending on which option is chosen, MetaEdit will either update the value, or the last part of the tag #here or #change/here, where here will be changed.

Hope this helps!

1 Like

im not a developer, maybe i will try to learn how develop a plugin

thx for your reply, and plz consider to add this feature

1 Like

I’m trying to create a button that updates a specified metadata field (either YAML or dvfield) that is in the same file as the button. Very similar to the example documented on the plugin wiki - Complete Task in Dataview Table - just not in a dataview table. Seems it should be simple enough, however with my limited programming skills I cant’ work it out. Anyone know how to achieve this?

p.s. - thank you @Christian for making such amazing plugins - metaedit and quickadd have transformed how I use Obsidian.

Hi, can you explain how you can delete property easily with the plugin ? I can’t seem to find a documentation for this.

Hey @Jeremy, glad to hear you like my plugins :slight_smile:

As for your question: I don’t have much experience with Buttons, but I tried my hand at making it work. From what I could tell, you’d want to either make it insert a Templater template into the file, where the template contains an API call to MetaEdit’s update.
You could also just make the button call a QuickAdd capture/macro, which could also call the update function.

When you open the MetaEdit menu, you’ll see on the right a :x:. Clicking that should allow you to delete the property.

1 Like

I asked because I thought there was an undocumented API function for deleting. Thank you again.

Ah, not currently. It’s planned, though. I am working on an update which would include it.

2 Likes

Thanks for getting back to me Christian. @imed actually helped me out by using the first method you suggested. For anyone that might be interested in the future here’s the template:

<%* 
const {update} = app.plugins.plugins["metaedit"].api 
const file = tp.file.find_tfile(tp.file.title) 
await update("<insert field>", "<insert value>", file) 
_%>
2 Likes

I’m currently trying to set up some habit tracking in obsidian. I want a button that will append a value to a list in the frontmatter. Any thoughts on this?

I’m working on a version that supports adding elements to list items in the frontmatter.
Until then, it’s currently not supported. QuickAdd has a feature that allows you to do this, though. You use the Insert After feature in a capture.

1 Like

I am getting a console error that was able to trace back to this plugin. Just wanted to report it here before filing on GitHub.