MetaEdit
MetaEdit copied to clipboard
`update`ing a multi value property does not work.
Have a file like:
---
foo: [a, b]
---
Call
await update('foo', ['a', 'c'], file);
You'll instead get:
---
foo: a,c
---
Hey @thorlucas, thank you for your report.
This is not a bug. As can be seen in the documentation for update
, the second parameter calls for a string.
update(propertyName: string, propertyValue: string, file: TFile | string)
At some point, I do want to be able to take in various types, though.
Hi I am running into a similar issue with a field populated with an array. My note has the following metatable:
---
foo: ["a", "b", "c"]
---
by calling:
await update('foo', updatedarray, file)
my note does not update.
However, if i call the following after having called update
:
await getPropertyValue('foo', note)
i can see that the property value has changed to updatedarray
for the metatable plugin.
I am working mainy from iOS.
IS that expected behaviour?
PS: that 'foo' is also an argument for a dataviewjs
codeblock. Not sure if it makes a difference in terms of access to editing the note's frontmatter.
Just as a fyi, if useful, i found a way around this in dataviewjs
:
when building the string variable for the update
function, I wrap each element of the array with "\""
and a coma between each wrapped element. Before passing the string as an argument to update
, I then wrap again in "["
& "]"
.
It is quite dirty but does the trick so far.