gtg922r / obsidian-numerals

An obsidian plugin which turns a math code block into a full featured calculator
Other
391 stars 8 forks source link

[Feature Request] Way to easily sum a group of variables #18

Closed Jack-Chronicle closed 3 months ago

Jack-Chronicle commented 1 year ago

Started using this recently, but noticed if you have a group of variables you have to name them each to sum them together, and aren't able to just request whatever heading they're under to sum them or sum from Variable A to Variable X and everything between them

I may be missing something that allows you to do this, but if not it would be great to add it

gtg922r commented 1 year ago

There is currently no way to do this, though I certainly understand the use case and have had the same issue.

Let me think of a reasonable syntax for such a thing.

ChristinWhite commented 1 year ago

I think Calca’s syntax is a reasonable approach to this problem:

F4016B34-A455-432D-902B-35E2798D44A0

It works quite well for some uses.

On the other hand, there are times when I really just want a quick running tally and would prefer to do away with assigning variables altogether and have some kind of Soulver mode where you add basic arithmetic and values and treat any text as a comment, then return the total at the end of the statement. Maybe a sum code block.

Jack-Chronicle commented 1 year ago

I think a way to incorporate this into the plug-in could be using indent levels?

The first level would be the sum total of those indented below it, similar to how the Sigma plug-in works

ChristinWhite commented 1 year ago

I've been playing with Numbr quite a bit and I really like it's syntax, definitely more so than Calca's:

# List of items

Item one:    256
Item two:   -512
Item three: 1024

List Variable = sum 

Basically, sum just grabs everything above it up to the most recent heading.

Unfortunately, I'm getting constant data loss with Numbr so I'm still back to searching for something dependable I can run on iOS until Numerals adds support for summing.

Stakker commented 1 year ago

Hello and thanks for making this excellent plugin :-)

I've been using Numi for quite a bit, and before that Soulver. I really love the fact that I can have everything inside Obsidian, but I'm also missing the "sum" function of Numi (and the similar functionality of Soulver) very much.

I'm often calculating yearly expenses month-by-month, so I have to define 12 variables, and then for the sum I have to actually write down the 12 variables again… which isn't optimal :-)

gtg922r commented 6 months ago

I've found a rather straight-forward way to implement this. And have the initial implementation done.

The syntax I am leaning towards is @sum or @total (its case-insensitive so capitalize however you like).

I would have liked to use sum or total to be similar to other apps, but someone may already have notes with total = blah + blah and I don't want to cause confusion there. There are other places I am using @ as a Numerals-specific directive, so I'm going to stick with that to force the user to be specific when doing a sum/total.

Thoughts on this syntax from folks?

image

ChristinWhite commented 6 months ago

Looks fantastic to me!

Jack-Chronicle commented 6 months ago

That looks great!

gtg922r commented 6 months ago

This is now live in Numerals 1.4 (Beta)

Would really appreciate beta testing and feedback prior to me pushing this out as a full release! Please see the instructions on the README for how to use BRAT to beta test!

Stakker commented 6 months ago

Looks like it's working, cheers! 🙏

gtg922r commented 3 months ago

Closing with public release of Numerals 1.5