Trying hard to make my #Obsidian dashboard with with dataviewjs but realizing my JavaScript skills are INCREDIBLY atrophied.

It’s so frustrating trying to solve a seemingly simple problem with code only to realize you have to master that code before even attempting to solve the problem.

@fraize How complex is the output that just dataview can't do?

@trinsec Great question. I want to perform a few transforms on the fields based on some conditions.

I have several component costs that have to be assembled into a final cost. Some of those costs are calculated based on value of OTHER costs, and if any of those values are null, treat them as zero.

Some numbers are formatted as percentage for display, some are currency.

I tried doing this in an inline-dataview inside a markdown table, but it got very complex very quickly.

Follow

@fraize Oh this involves _calculations_? Right, that's something I haven't gotten around to. I'm great at very much abusing dataview with choice() map() etc to have a varied display going, but no actual calculations (yet). ;)

@trinsec hilariously my path went the other way. I was doing calculations before ever trying to figure out .map(). I've forgotten so much about JS that I forgot how to deal with arrow functions and what the .map() function did.

Using inline dataviewjs, I could refer to this-page's metadata using *Order Total:* $ `$=this.wholesale * this.moq` but if this.wholesale was null, the inline-js would throw an error. To implement functions to clean the data, I'd need a whole dataviewjs block instead.

@fraize
And in the meantime I'm slowly but surely starting to outgrow what dataview itself can offer me... I have to start learning JS sometime. ;)

I have to eventually, anyway, as I might also want to look into how to make plugins, and I understand TypeScript is a fancy form of JS.

@trinsec I think that's right. I believe TypeScript is just strongly-typed JS with interfaces and prototyping.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.