Can anyone point me to the relevant documentation on how to sum all the entries in a data tiddler and display the name + value?
I am trying to keep records from a renovation project in TW and would like to construct tables with items and cost of items plus the total. Data would be sitting in data tiddlers. An example of a data tiddler could be:
item1:50
item2:2500
labor:700
Is it better to use properties ?
Is TW event a good fit for this type of record keeping ?
Just a quick answer i think tiddlywiki is suitable and it is possible to do what you ask.
You just need a filter to extract the values you want and you can sum them with add. Within a filter the numbers will be concidered titles, you need to ensure no deduplication occurs, ie duplicates eg the same number twice is not reduced to one. See the = symbol.
I may give a fuller answer later today if no one else has.
A lot of beginners have the misapprehension that data tiddlers are the main structure for handling data. But data tiddlers are actually an after thought. If you look at the list of available filter operators for data tiddlers, there’s almost nothing – just 3 or four.
In Tiddlywiki, the main data structure is the tiddler, and there are dozens of filter operators to manage tiddlers.
So if you make 3 tiddlers:
item1
item2
labor
and give them each an expense field:
expense: 50
expense: 2500
expense: 700
Then you can sum them up just like this:
{{{ [has[expense]get[expense]sum[]] }}}
Any solution with data tiddlers will be somewhat more complicated. If your data tiddler is called ‘data’, then you can get the sum of all values like this:
EDIT: ARG, I misread the OP. All expenses in one data tiddler, that’s very different from what I was thinking (i.e. “expense” as a single data item for each of many data tiddlers.)
EDIT Deux: {{{ [[List of expenses]indexes[]] :map[[List of expenses]getindex<currentTiddler>] +[sum[]] }}}
Yeah, I enjoy this stuff a little too much …