Meta-edit problems?

What I’m trying to do

I’m trying to insert a propertly while I’m making the note in templatar. I have a suggestion that supplies me a list of files; I want that string to be a property of the newly created file but it is never filled in.

I can also open another file and perform the operation on it successfully
Any help would be appreciated. Thanks

Things I have tried

const {update, createYamlProperty, getPropertyValue} = this.app.plugins.plugins["metaedit"].api;

const addUpdate = async (field, value, tfile) => {  
var exist = await getPropertyValue(tfile);  
if (typeof(exist) != 'undefined') {  
	await update(field, value, tfile);  
} else {  
	await createYamlProperty(field, value, tfile);  
}  
}

selectedItem = "value"  
filename = tp.file.path(true)  
console.log(filename);  
// Using tp that templater exposes
await addUpdate("<<PROPERTY>>", selectedItem, tp);
// The above statement runs but not reflected in the proeprty. 

//The following are accessing an external file and setting the property.
await addUpdate("<<PROPERY>>", selectedItem, tp.file.find_tfile("Applications/file1.md") );

await addUpdate("<<PROPERY>>", selectedItem, tp.file.find_tfile("Applications/file2.md"));

await addUpdate("<<PROPERY>>", selectedItem, tp.file.find_tfile("Applications/file3.md"));

await addUpdate("<<PROPERY>>", selectedItem, tp.file.find_tfile("Applications/file4.md"));

// All the above execute properly 

I’m wondering if I need to flush something before running the command in the template.

don’t use metaedit for properties
use obsidian’s built-in app.fileManager.processFrontMatter

there are many examples on how people have used it scattered everywhere on the forum

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