> I have a number of tiddlers containing a data field e.g. Cost and I
> have been trying to use ForEachTiddlerMacro to produce a final total
> of all the Costs.
...

>From the description of what you have attempted, it sounds like you
are at least somewhat comfortable with some simple programming
techniques...

If that is the case, then I suggest that you use
   http://www.TiddlyTools.com/#InlineJavascriptPlugin

then, you can write something like this:
<script>
   var tids=store.getTiddlers('title');
   var count=0; var total=0;
   for (var i=0; i<tids.length; i++) {
      var d=store.getValue(tids[i].title,'cost');
      if (d) { count++; total+=parseInt(d); }
   }
   if (count) return total;
</script>

Note: use of 'store.getValue()' assumes you are using a 'custom
tiddler field' to hold the data.  If you are using a 3rd-party plugin,
such as DataPlugin, then you will, of course, need to use the
appropriate plugin-defined function to retrieve the data value from
the tiddler.  Nonetheless, the rest of the above code should be the
same.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to