Hi Alex,
 

> Do you think it would be worth creating a calcs tiddler with common calcs, 
> such as squared, percent?
>

I think it would make sense to have topic-specific tiddlers wherever those 
computed values are necessary. So, I don't think I'd want a generic "calcs" 
tiddler, or know what to put in it and why.

1) Perhaps you'd rather want macros using the eval widget, but calculating 
simple or sophisticated things in a parametric manner, e.g.:

\define ++(val) <$eval>{{$val$}}+1</$eval>

<<++ !!myfield>>

2) Also, what works quite well, and I didn't know it would, is to further 
calculate with a field containing a computation.

So, let's say we take your field from the last example:

kcal-carbs: <$eval>{{Carbo-needs!!kcal-per-day}}*{{Carbo-needs!!carbs-
percent}}/100</$eval>

You can simply keep calculating with it:

<$eval>{{Carbo-needs!!kcal-carbs}}*2</$eval>

3) A third method would be to use templates, e.g.

title: $://total-price

<$eval>({{!!price}} + {{!!shipping}}) * (1+{{$:/finance/tax-rates!!vat}}/100
)</$eval>

And then:

title: Basket

total: {{||$://total-price}}

So, there's three ways to leverage the eval *widget*.

   1. macros
   2. fields containing the widget
   3. templates

Best wishes,

Tobias.

-- 
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/8d2a7d2a-28cc-4d48-a819-b40913713093%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to