Replies: 1 comment
-
Sorry you had to wait so long for a reply. This paragraph is copy-pasted because I'm going everywhere I saw people asking about this and not getting a response. Documentation on this is just missing a tiny step. When you're in the footer of your database, you're able to use the function myFunction(colValues) {
return colValues.length;
}
module.exports = myFunction Create a database. In the settings of your database, enable JavaScript formulas and set the "Formula Settings" directory to |
Beta Was this translation helpful? Give feedback.
-
Hey ! I’ve been using Obsidian for a few days now, along with dataview and database folder to monitor some habits I have and manage my tasks.
For the last days I’ve been looking everywhere to try and get an average formula working in the footer section of my database folder file, as it provides with sum, min, max, but no average, and after reading the documentation and searching online, I’ve found literally nothing except someone asking the same question in an unrelated post.
Things I have tried
As I don’t know js at all and saw that ${values} in formula was returning me every entry in the column, I naively tried things like ${avg.values} or ${values.average}, and after that dividing the sum by the length, but all I get it an empty footer so I’m not writing correct code anyways. I also tried importing a js file, turning on javascript formulas in the parameters and referencing the function in the footer but it wouldn’t work either and I must have missed a step (I used the example formula given on GitHub, but it doesn’t come with exact install explanations, and I couldn’t seem to get obsidian to recognize that I’d put a js file to reference in my folder)
I wonder what I’m missing cause honestly it feels like it should be really simple and I’m just not understanding something very obvious about syntax or whatever, but I figured I also so the question elsewhere with no answers so I might ask for future reference for beginners like me.
Thanks a lot !
PS : I’m also on mobile but so far I’ve had no issues applying pc tutorials
Beta Was this translation helpful? Give feedback.
All reactions