Hi Vincent

Good to hear from you, and delighted you're interested in TW5.

I think my TWtcalc plugin can help on this (see
> http://twtable.tiddlyspace.com/#TWtcalc--Example--IF_and_COUNT for an
> example). It has a simple parser that recognizes predefined function names
> (aliases possible) and does calculations according to their definitions. It
> is currently equipped with about 15 predefined functions, including sum,
> avg, etc., and is quite easy to extend. Currently it works on TiddlyWiki
> tables using the OpenOffice.calc/Excel like syntax, but I think to
> accomplish what's mentioned in the ticket, the followings would do:
>

Your TWtcalc is a lovely plugin, a nice simple idea very fully executed.


>
>    1. take the core functions (parser and evaluator) that work on plain
>    text, maybe modify the syntax analyzer to work with the fields things;
>    2. take the predefined function set, reduce/modify to work with fields;
>    3. design the syntax and modify the codes that handles fields to make
>    use of the functions taken in step 1 (most likely only one is needed, the
>    TWtcalc.evaluate(txt, start [,...]) function)
>
> Step 1 and 2 are easy for me, just need to know how to take values from
> fields. If some one can do step 3 then it should be done.
>
The big issue for me around these calculations is selecting the best
syntax. Currently TW5 already has two languages built-in: JavaScript
itself, and the filter syntax. I've been reluctant to add a different
syntax for general numeric calculations.

The tension with the design of the filter syntax is that the more
complicated it gets, the more one ends up thinking that it might as well
have been JavaScript. So, my design goal for the filter syntax is to be
simple and expressive, and I'm not worrying too much whether or not it's
complete enough.

So, two options for proceeding might be be:

1) Port the existing TWtcalc, complete with the existing formula syntax, as
a new TW5 plugin
2) Work together on extending the TW5 filter syntax to encompass numeric
operations, and the plumbing necessary to make spreadsheet functionality be
native to the core

The big difference is that (1) is a fairly self-contained job while (2)
will require much more understanding of the existing internals of TW5.

Best wishes

Jeremy



> Have fun!
> Vincent
>
>
>
> On Wednesday, December 4, 2013 10:02:46 PM UTC+8, Jeremy Ruston wrote:
>
>> Hi Jeff
>>
>> None of that is implemented today, but is planned. Your examples are very
>> useful, so I've transferred them to a ticket:
>>
>> https://github.com/Jermolene/TiddlyWiki5/issues/254
>>
>> Many thanks
>>
>> Jeremy.
>>
>>
>> On Tue, Dec 3, 2013 at 9:34 PM, <chis...@gmail.com> wrote:
>>
>>> In TW5, is it possible to sum the values of a field from multiple
>>> tiddlers?
>>>
>>> Something like:
>>> title: Project Finances
>>>
>>> [tag[expense]sum[cost]] --> 150
>>>
>>> ---
>>>
>>> title: Expense A
>>> tag:expense
>>> cost:100
>>>
>>> ---
>>>
>>> title: Expense B
>>> tag:expense
>>> cost:50
>>>
>>>
>>> In general, is there (will there be) operators for (numerical) fields
>>> such as sum, average, greater than, less than, equal to, etc?
>>>
>>> Just throwing out more ideas that come to mind:
>>>
>>> title: Project Finances
>>> Budget:200
>>> expenseA:100
>>> expenseB:50
>>> expenseC:200
>>>
>>>
>>> {{expenseA + expenseB}}  --> 150
>>>
>>> or
>>>
>>> [title[Project Finances]sum[expenseA, expenseB]] --> 150
>>>
>>> or
>>>
>>> [title[Project Finances]sum[fieldsearch[expense*]]] --> 350
>>>
>>> or
>>>
>>> [title[Project Finances]avg[expenseA, expenseB]] --> 75
>>>
>>> or
>>>
>>> [title[Project Finances]calc[Budget - sum[expenseA, expenseB]]] --> 50
>>>
>>> -Jeff
>>>
>>>
>>>  --
>>> 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 tiddlywiki+...@googlegroups.com.
>>> To post to this group, send email to tiddl...@googlegroups.com.
>>>
>>> Visit this group at http://groups.google.com/group/tiddlywiki.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> --
>> Jeremy Ruston
>> mailto:jeremy...@gmail.com
>>
>


-- 
Jeremy Ruston
mailto:jeremy.rus...@gmail.com

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to