Ok, as often just after asking the question I likely resolved the first issue by using this widget in the "totalvalue" field.
<$formula formula="sum([<currentTiddler>listed[to]get[value]]) - sum([ <currentTiddler>listed[from]get[value]]) + sum([<currentTiddler> get[initialvalue]])"/> The second problem is still alive and kicking though: how can I get the sum value of all the tiddlers tagged with "accounts"? On Sunday, April 1, 2018 at 7:45:31 PM UTC+2, [email protected] wrote: > > hello everyone, > > so, I'm making a tiddlywiki to keep track of expenses, incomes and such, > using gentag <http://ooktech.com/jed/ExampleWikis/GenericTagFields/> and > formula <http://evanbalster.com/tiddlywiki/formulas.html> plugins. > > Now, the structure would be something like this (just an example): > > * accounts > **bank > **cash > *expenses > **car > **mortgage > * incomes > **work > **teeth selling > > Each transactions would be a tiddler with the fields: from, to, value. > > Every book will have a type field, for example bank would have "account". > work "incomes" and so on. > > > So, if I want to know the value of all the money in my bank, I could just > use the formula widget by doing so, and it works alright: > > <$formula formula="sum([[bank]listed[to]get[value]]) - > (sum([[bank]listed[from]get[value]])) + > sum([all[current]get[initialvalue]])" precision=3/> > > The problem arises in two points: > > 1: if I want a general formula that I can use for every tiddler and just > paste it as a macro. This is what I've tried so far: > > > \define accountValue() > > <$formula formula="sum([$(book)$listed[to]get[value]]) - > (sum([$(book)$listed[from]get[value]])) + > sum([all[current]get[initialvalue]])" precision=3/> > \end > > <$set name=book value=<<currentTiddler>>> > <<accountValue>> > </$set> > > This only considers the initialvalue field, no in and outs. > > 2. I would then like to get all the value of all the accounts, let's say > bank and cash, so I tried to put the first formula widget in a "totalvalue" > field, and to call it from an "account" tiddler, like so: > > <$formula formula="sum([[accounts]listed[type]get[totalvalue]])/"> > > but I only get an error > > CompileError: invalid operand > "sum([[accounts]listed[type]get[totalvalue]])/" > > > So... frankly, there is something I'm missing, but I've been working on it > for 3 days now, trying to understand what's the issue, making a macro in a > macro in a macro calling different variables with set widget, but no good. > > > I hope I managed to explain myself, I would greatly appreciate any help, > of course once done it will go in my github with the other tiddlywikis! > > > All the best and have a nice day > > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/90b625fd-892d-4cbb-9f41-026fc0c80f36%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

