me asking eric of tiddlytools.com for advice, really...

54 views
Skip to first unread message

Kashgarinn

unread,
Nov 22, 2007, 6:21:33 AM11/22/07
to TiddlyWiki
Hi there.

I was wondering if I could ask eric for help in this thread here :P

You know your beautiful Columncalculator plugin (found on
tiddlytools.com)? I was wondering.. would it be possible to use it in
one tiddler to calculate a table in another?

If it would be possible.. that would be very interesting :D

K.

Eric Shulman

unread,
Nov 22, 2007, 7:51:15 AM11/22/07
to TiddlyWiki
> You know your beautiful Columncalculator plugin (found on
> tiddlytools.com)? I was wondering.. would it be possible to use it in
> one tiddler to calculate a table in another?

short answer: probably not.

long answer:

The data that the <<columnCalc>> macro operates on are not retrieved
from the tiddler's source content. Instead, the macro extracts the
data values that it uses from the cells directly above it in a
*rendered* wiki-syntax table. This enables you to embed macros that
render the data values that will computed upon. For example, you can
write:

|<<tiddler "TiddlerName::SliceName">>|
|<<tiddler "TiddlerName::OtherSliceName">>|
|<<tiddler "OtherTiddlerName::YetAnotherSliceName">>|
| ... etc... |
|<<columnCalc average 1 -1>>|

to insert slice values from other tiddlers into a table column and
then calculate the average, total or count using the <<columnCalc>>
macro in a table cell at the bottom of the column.

However, <<columnCalc>> can only operate on data that are contained
within the same table as the macro itself, because it relies upon the
relative position of the table cell DOM elements to locate the desired
data values. In fact, the macro can't even be placed at the top of a
column in order to add up the data cells below it because, at the time
that the macro is evaluated those table cels haven't been rendered
yet!

Let suppose that I could somehow enable the macro to be placed
somewhere else...

Even then, it would still use *rendered* data, so any tiddler
containing a table of data would have to actually be showing at the
time that the calculation is done... not to mention the difficulty in
locating the desired data from within a table contained in a different
tiddler...

All of which seems to be painfully complex to implement and would
likely still have very limited abilities for building any kind of
really meaningful applications.... which leads right back to my
initial "short answer" conclusion to your question: "probably not".

-e
Eric Shulman
TiddlyTools / ELS Design Studios

ref: http://www.TiddlyTools.com/#ColumnCalculatorPlugin

Kashgarinn

unread,
Nov 22, 2007, 9:00:21 AM11/22/07
to TiddlyWiki
Yeah.. darnit.. I'm trying to think around this somehow..

you see, I have this table I create with tasktimer (there's one table
created daily, each in their own dated tiddler), and at the end of
each table I have columncalculator macros adding up the columns, and I
was wondering how I could possibly add up those calculated values into
a weekly overview, or monthly overview..

I'm kinda stumped on how I could do this..

I want columncalculator to work like it does, because if I change the
values in the tables, I want that to reflect in the totals below.

But that makes it a non-referencable target for macros in other
tiddlers (I'm guessing, don't know the power of javascript really)..
so I'm wondering how this could be solved..

After I've reviewed the tables, they stay pretty much static, so
perhaps I just need some way to change the columncalculator stats into
text, so that it can be referenced in another tiddler as a slice.

- So is that perhaps possible?

K.

Ken Girard

unread,
Nov 22, 2007, 2:47:09 PM11/22/07
to TiddlyWiki
Would it be possible to place the daily number into a custom field,
and then use that data to do your weekly/monthly math?

Ken Girard

Kashgarinn

unread,
Nov 23, 2007, 7:58:07 AM11/23/07
to TiddlyWiki
I'm thinking that the best/worst way to do this would be to implement
foreach tiddler plugin..

See if I can't just grab all the tables from the tiddlers I need, and
insert the columncalculator at the end.. now to write the foreach
tiddler macro call... I'll have to wrap my head around how to do
that, as it'll probably have to be pretty complicated.

K.

Kashgarinn

unread,
Jan 7, 2008, 8:39:09 AM1/7/08
to TiddlyWiki
Hi there, I'm still contemplating this problem, as it's still
something I'm looking into.

Ok, logging things with the tasktimerplugin and using columncalculator
plugin at the bottom of each table is clearly plenty if all you need
is day-to-day overview..

But for a weekly, or monthly overview, it's kinda crap, as you can't
get the information needed from the individual tiddlers.

I've been going over the options available.. wondering why this is so
hard, when it suddenly dawned on me... if each comment/log was stored
as a tiddler title, then I have access to the tags and fields of the
tiddler, and I could keep the relevant information in there, and even
add text to the tiddler itself if I wanted.

That way, foreachtiddler would easily work to gather the needed data.

So changing tasktimer to create a tiddler is the way to go I think.

K.

On Nov 23 2007, 12:58 pm, Kashgarinn <steint...@gmail.com> wrote:
> I'm thinking that the best/worst way to do this would be to implement
> foreach tiddler plugin..
>
> See if I can't just grab all the tables from the tiddlers I need, and
> insert thecolumncalculatorat the end.. now to write the foreach
> tiddler macro call... I'll have to wrap my head around how to do
> that, as it'll probably have to be pretty complicated.
>
> K.
>
> On Nov 22, 7:47 pm, Ken Girard <ken.gir...@gmail.com> wrote:
>
> > Would it be possible to place the daily number into a custom field,
> > and then use that data to do your weekly/monthly math?
>
> > Ken Girard
>
> > On Nov 22, 8:00 am, Kashgarinn <steint...@gmail.com> wrote:
>
> > > Yeah.. darnit.. I'm trying to think around this somehow..
>
> > > you see, I have this table I create with tasktimer (there's one table
> > > created daily, each in their own dated tiddler), and at the end of
> > > each table I havecolumncalculatormacros adding up the columns, and I
> > > was wondering how I could possibly add up those calculated values into
> > > a weekly overview, or monthly overview..
>
> > > I'm kinda stumped on how I could do this..
>
> > > I wantcolumncalculatorto work like it does, because if I change the
> > > values in the tables, I want that to reflect in the totals below.
>
> > > But that makes it a non-referencable target for macros in other
> > > tiddlers (I'm guessing, don't know the power of javascript really)..
> > > so I'm wondering how this could be solved..
>
> > > After I've reviewed the tables, they stay pretty much static, so
> > > perhaps I just need some way to change thecolumncalculatorstats into
> > > text, so that it can be referenced in another tiddler as a slice.
>
> > > - So is that perhaps possible?
>
> > > K.
>
> > > On Nov 22, 12:51 pm, Eric Shulman <elsdes...@gmail.com> wrote:
>
> > > > > You know your beautifulColumncalculatorplugin (found on

Kashgarinn

unread,
Jan 7, 2008, 9:23:19 AM1/7/08
to TiddlyWiki
I probably stopped a few lines short in the last email.. I thought I
could just add "store.savetiddler(txt)", throw in a few fields
somewhere, add the [[ ]] needed in the line which tasktimer puts out
and call it nicely done..

It kind of is that easy, but I don't have the know-how to do it.. I'm
feeling guilty to rely so much on Eric for this, so I'll definitely
try and see if I can't figure my way out of it, but as always, his
help is greatly appreciated :)

K.

Kashgarinn

unread,
Jan 7, 2008, 10:42:43 AM1/7/08
to TiddlyWiki
Hmm, I'm going to ignore fields until I 'get' them better.. until then
foreachtiddler and keeping the stuff in tiddler text might be better
for now.

I added this into the tasktimer:

var newtesttxt = "started: "+start+"\n"+"stopped: "+stop
+"\n"+"elapsed: "+elapsed+"\n"+"Navision: "+test+"\n";
store.saveTiddler(txt,txt,newtesttxt,config.options.txtUserName,new
Date(),"'"+here.target+"'");

- and the TW all of a sudden became very, very slow to save and
reload... no idea why.. going to see if I can't find that out :)

K.

Kashgarinn

unread,
Jan 7, 2008, 12:43:45 PM1/7/08
to TiddlyWiki
I'm sorry for the spammy nature of this post, I'm just really excited
about getting this to work, and it sometimes bubbles over as too many
posts :)

The slowness wasn't any changes fault, I was fiddling around with
foreachtiddler before, and a linked tiddler with a heavy
foreachtiddler macro was making it slow.

Changing the link did the trick, now I can reference the data as
slices for a foreachtiddler search, now I just need to make that
pretty and usable, and I'm all set for using a foreachtiddler macro to
do all the work I need to let it do.

Shame I can't retroactively format the task-tables into links, would
be fun to see it work for the last couple of months.

K.

FND

unread,
Jan 7, 2008, 2:06:02 PM1/7/08
to Tiddl...@googlegroups.com
> Shame I can't retroactively format the task-tables into links, would
> be fun to see it work for the last couple of months.

Can you give me an example of the data you have, and want to end up
with? Maybe(!) I can whip up a quick transformation script...


-- F.

Eric Shulman

unread,
Jan 8, 2008, 12:43:44 AM1/8/08
to TiddlyWiki
> I added this into the tasktimer:
> var newtesttxt = "started: "+start+"\n"+"stopped: "+stop
> +"\n"+"elapsed: "+elapsed+"\n"+"Navision: "+test+"\n";
> store.saveTiddler(txt,txt,newtesttxt,config.options.txtUserName,new
> Date(),"'"+here.target+"'");

You can do this with the unmodified <<taskTimer>> macro, just by using
parameters:

<<taskTimer ask "started: %1\nstopped: %2\nelapsed: 3\nNavision%0">>

where:
'ask' will prompt for the 'target tiddler' (in your case, enter the
description)
and the 'format string' that follows uses
%0 = description (in your case, leave blank, or enter a link??)
%1 = start time
%2 = stop time
%3 = elapsed time.

HTH,

Kashgarinn

unread,
Jan 8, 2008, 5:30:05 AM1/8/08
to TiddlyWiki
I think you misunderstand what I did.

I want the tasktable to be created in the journal tiddler du jour like
normal, I just added the ability that the description text is a title
of a new tiddler, and the text contains the data itself in slice form.

That means in theory I could create a forEachTiddler macro which grabs
the slices from each tiddler into a table and have a footer in that
table with the columncalculator macro.. although it's not working for
some reason.. I'm getting "0" instead of the sum of the cells, so
something is working, it's just not adding for some reason.

Here is the foreachtiddler macro I was testing:

<<forEachTiddler
where 'tiddler.tags.contains("7 January 2008")'
script 'function writeExpenseRow(index, tiddler, context) { var
result = ""; if (index == 0) {context.sum = 0; result = "|!Date|!
Started|!Stopped|!Elapsed|!Navision|!Description|\n";} result +=
"|"+tiddler.created+"|<<tiddler [["+tiddler.title+"::started]]>\>|<
\<tiddler [["+tiddler.title+"::stopped]]>\>|<\<tiddler
[["+tiddler.title+"::elapsed]]>\>|<\<tiddler [["+tiddler.title
+"::Navision]]>\>|"+tiddler.title+"|\n"; return result;}'
write
'writeExpenseRow(index, tiddler, context)'
end '"|bgcolor(lightblue):|bgcolor(lightblue):|bgcolor(lightblue):|
bgcolor(lightblue): <\<columncalc sum 2 -1>\>|bgcolor(lightblue): <
\<columncalc sum 2 -1>\>|bgcolor(lightblue):|"'
>>

Hopefully I can make this work..
K.

Kashgarinn

unread,
Jan 10, 2008, 5:59:39 AM1/10/08
to TiddlyWiki
W00t, it finally works :D

It's not perfect, but it's working, finally.

Here's an overcap of what I'm doing:
1) In my mainmenu I have the macro: <<taskTimer today>> which creates
a table and a new line into that table each time I click the task
button.
2) the descriptive text is then also created as a tiddler with the tag
"tasktiddler", and its content are the slices:
started: 10:08:47
stopped: 10:10:06
elapsed: 00:01:19
3) then in a monthly overview I have the foreach macro:
<<forEachTiddler
where 'tiddler.tags.contains("tasktiddler")'
sortBy 'tiddler.created'
script 'function writeExpenseRow(index, tiddler, context) { var
result = ""; if (index == 0) {context.sum = 0; result = "|!Date|!
Started|!Stopped|!Elapsed|!Navision|!Description|\n";} result +=
"|"+tiddler.created.formatString("DD MMM YYYY")+"|<<tiddler
[["+tiddler.title+"::started]]>\>|<\<tiddler [["+tiddler.title
+"::stopped]]>\>|<\<tiddler [["+tiddler.title+"::elapsed]]>\>|<
\<tiddler [["+tiddler.title+"::Navision]]>\>|"+tiddler.title+"|\n";
return result;}'
write
'writeExpenseRow(index, tiddler, context)'
end '"|bgcolor(lightblue):|bgcolor(lightblue):|bgcolor(lightblue):|
bgcolor(lightblue): time total: <\<columncalc sum 2 -1>\>|
bgcolor(lightblue): time total: <\<columncalc sum 2 -1>\> lines total:
<\<columncalc numcount 2 -1>\>|bgcolor(lightblue):|"'
>>

which picks up the slices in each tasktiddler and displays them. So
now I can finally see an overview of each month, it's not perfect, but
it's getting there.

I did run into a problem with columncalculator, I didn't understand
why until I checked the cell content with firebug, seems that when
grabbing slices the data is represented like this:

<span refresh="content" tiddler="AC 244164: Fríða Reynisdóttir Póst
aðgangsmál::elapsed">00:04:09</span>

So I had to change the code in columncalculator for it to understand
slice references (it's not pretty, but it works :) ).

I'm wondering about the times when a tasktiddler already exists, that
means the information in it gets overwritten. As most of the
important lines already have a unique identifier from the ticketing
system I'm working with, I don't really worry too much about those,
it's the "X called asking for Y" I'm thinking about, and I'd be plenty
satisfied with if for those tasktiddlers I'd just add the current date
to the tag field.

I am interested in looking more closely at the creation of a
tasktiddler, and the management of the data in it, for instance what
if a tasktiddler already exists which I didn't want to be overwritten,
or just the tag added? what if I wanted to add the new slice data,
and leave the data already in there without mucking it up? And how
would then a foreachtiddler macro handle that scenario?

Of course the answer is I'd have to replace the for each tiddler macro
with a macro of my own to handle that, and that's too much for me to
handle right now.

- Oooh, just had a brainstorm, the tasktable can use the slices as
well! then I only need to change it in the tiddler :D

thanks for the help, Eric, without your tasktimer plugin and
columncalculator I wouldn't be having this much fun at work :)

If you're interested in checking out the changes I did, here's
columncalculatorplugin: http://tiddlywiki.pastebin.com/m1d3f658a and
here's tasktimerplugin: http://tiddlywiki.pastebin.com/m6e8bcd39

Regards,
K.

Eric Shulman

unread,
Jan 10, 2008, 9:08:26 AM1/10/08
to TiddlyWiki
> If you're interested in checking out the changes I did, here's
> columncalculatorplugin:http://tiddlywiki.pastebin.com/m1d3f658aand
> here's tasktimerplugin:http://tiddlywiki.pastebin.com/m6e8bcd39

Please read:

http://www.TiddlyTools.com/#FAQ_ModifyingTiddlyToolsPlugins

thanks,
-e

Kashgarinn

unread,
Jan 10, 2008, 8:13:04 PM1/10/08
to TiddlyWiki
Yeah, I just posted that for you, I'm not editing or modifying it
enough to warrant a licence change, and have no interest in doing so,
thanks for the link though, if that changes I'll use that as a
benchmark for modifications.

Plus, you're active enough that I'd rather see if what I'm thinking or
doing is what you'd be interested in for your plugins.

K.

HeX

unread,
Mar 10, 2008, 2:17:22 PM3/10/08
to TiddlyWiki
I was wondering if with a simple enhancement of the TaskTimerPlugin it
would be possible to get monthly or what ever summaries of the task
times.
Eric, how hard would it be to include a simple field to also state the
date of the task.

Something along the lines:
//Description//|//Date//|//Started//|//Stopped//|//Elapsed//|
|MyDescription|2008-03-10|18:19:45|18:19:50|00:00:05|
/%tasktimer%/

I'm not into programming of JS but I gather that this shouldn't be
such a big brainer.

Then one could actually cut and paste the range of days to a different
tiddler and use the columncalculator on that. For me that would be
sufficient.

What do you think?

/HeX

PS: Thanks to Kashgarinn for the quick help with the Macrocode. As it
turns out I would still have to make a couple of tweaks you mentioned
but are not accessible any more. But never mind as I would prefer a
simple solution anyway. (I tend to forget any custom changes and that
strikes every time I make an upgrade of some sort ;))



On 11 Jan, 02:13, Kashgarinn <steint...@gmail.com> wrote:
> Yeah, I just posted that for you, I'm not editing or modifying it
> enough to warrant a licence change, and have no interest in doing so,
> thanks for the link though, if that changes I'll use that as a
> benchmark for modifications.
>
> Plus, you're active enough that I'd rather see if what I'm thinking or
> doing is what you'd be interested in for your plugins.
>
> K.
>

HeX

unread,
Mar 12, 2008, 10:42:24 AM3/12/08
to TiddlyWiki
OK I figured out the changes to add a date column. Only thing left
would be to get the columncalc macro to ignore a line with /%tasktimer
%/. Then one could actually have a static expression which calculates
all the totals automatically.

E.g.,
!!! March 2008
|//Date//|//Description//|//Started//|//Stopped//|//Elapsed//|
|2008-03-09|Comment |20:29:00|23:38:00|03:09:00|
|2008-03-10|Comment 11:15:00|12:40:00|01:25:00|
|2008-03-11|Comment |17:30:00|20:00:00|02:30:00|
/%tasktimer%/
|>|>|>|>|>|
| | | | ''Total:''| <<columncalc sum 1 -3>>|

And here is the local diff of my changes:

--- TaskTimerPlugin 2008-03-12 14:27:33.000000000 +0100
+++ TaskTimerPluginWithDate 2008-03-12 15:32:17.000000000 +0100
@@ -1,5 +1,5 @@
/***
-|Name|TaskTimerPlugin|
+|Name|TaskTimerPluginWithDate|
|Source|http://www.TiddlyTools.com/#TaskTimerPlugin|
|Documentation|http://www.TiddlyTools.com/#TaskTimerPluginInfo|
|Version|1.2.2|
@@ -12,7 +12,7 @@
|Description|'timer' button automatically writes start/end/elapsed
time into tiddler content|
Quickly generate 'timed task' logs that can be used for status
reports, billing purposes, etc.
!!!!!Documentation
-> see [[TaskTimerPluginInfo]]
+> see [[TaskTimerPluginInfo]] and for the changes
[[TaskTimerPluginWithDateDiff]]
!!!!!Revisions
<<<
2008.03.10 [*.*.*] plugin size reduction - documentation moved to
[[TaskTimerPluginInfo]]
@@ -28,16 +28,16 @@
config.macros.taskTimer = {
label: "start timer",
title: "press to start the task timer",
- format: "|%0|%1|%2|%3|\\n", // note: double-backslash-en
+ format: "|%0|%1|%2|%3|%4|\\n", // note: double-backslash-en
defText: " ", // default description text
todayKeyword: "today",
todayFormat: "0MM/0DD/YYYY", // default format - superceded by
CalendarPlugin, DatePlugin, or DatePluginConfig
- defHeader: "|//Description//|//Started//|//Stopped//|//Elapsed//|
\n",
+ defHeader: "|//Date//|//Description//|//Started//|//Stopped//|//
Elapsed//|\n",
defTarget: "ActivityReport",
prompt: "Enter a short description for this activity. Press
[cancel] to continue timer.",
askMsg: "Enter the title of a tiddler in which to record this
activity. Press [cancel] to continue timer.",
- createdMsg: "'%0' has been created",
- updatedMsg: "'%0' has been updated",
+ createdMsg: "'%1' has been created",
+ updatedMsg: "'%1' has been updated",
marker: "/%"+"tasktimer"+"%/",
tag: "task",
handler:
function(place,macroName,params,wikifier,paramString,tiddler) {
@@ -92,7 +92,8 @@
var m=diff.getUTCMinutes(); if (m<10) m="0"+m;
var h=diff.getUTCHours(); if (h<10) h="0"+h;
var elapsed=h+":"+m+":"+s;
- var newtxt=before+format.format([txt,start,stop,elapsed])+after;
+ var taskDate=(new Date()).formatString("YYYY-0MM-0DD")
+ var newtxt=before+format.format([taskDate,txt,start,stop,elapsed])
+after;
var newtags=(tiddler?tiddler.tags:['task']); // include 'task' tag
when creating new tiddlers

store.saveTiddler(here.target,here.target,newtxt,config.options.txtUserName,new
Date(),newtags,tiddler?tiddler.fields:null);
if (!tiddler)
displayMessage(this.createdMsg.format([here.target]));

/HeX

Eric Shulman

unread,
Mar 12, 2008, 12:55:56 PM3/12/08
to TiddlyWiki
> OK I figured out the changes to add a date column. Only thing left

Actually, most (but not all) of the changes could already be done by
using a separate [[TaskTimerPluginConfig]] tiddler to override some of
the plugin's internal defaults. The only change to the plugin that
was really needed was to actually pass the datestamp into the format
string used to generate each table row.

I've updated the plugin (and created a sample ...Config tiddler), so
that the default table output now includes a datestamp.

Get the update (v1.3.0) here:
http://www.TiddlyTools.com/#TaskTimerPlugin
http://www.TiddlyTools.com/#TaskTimerPluginInfo
http://www.TiddlyTools.com/#TaskTimerPluginConfig (new)

enjoy,
-e

HeX

unread,
Mar 12, 2008, 2:25:16 PM3/12/08
to TiddlyWiki
Thanks, your version is much cleaner, well mine was a hack anyway :)

Also thanks to the TaskTimerPluginConfig I could now set up my
insertion point as:
config.macros.taskTimer.marker="| | | | ''Total:''| <<columncalc sum 1
-2>>|"; //

Which plays nicely along with the columncalc plugin.

/HeX
PS: Eric, you've got a minor typo in the comments of TaskTimerPlugin:
superceded --> superseded

Eric Shulman

unread,
Mar 12, 2008, 3:09:07 PM3/12/08
to TiddlyWiki
> PS: Eric, you've got a minor typo in the comments of TaskTimerPlugin:
> superceded --> superseded

A quick check on Wikipedia and some online dictionaries indicates that
*both* spellings are in common usage (though some people adamantly
*insist* that the "c" spelling is "incorrect" and *only* the "s"
spelling is acceptable)

The Wikipedia discussion includes the following observation:
----------------------
...the trend toward "supercede" is understandable because "supersede"
is the only English word ending with "-sede." "Superseded" would
probably have been superseded by "supercede" were it not for the very
number of sources noting the common error.
----------------------

:-)

-e

refs:
http://en.wikipedia.org/wiki/Wikipedia_talk:Lists_of_common_misspellings#Supercede_vs._Supersede
http://dictionary.reference.com/browse/supercede
http://dictionary.reference.com/browse/supersede
http://www.yourdictionary.com/supercede
http://www.yourdictionary.com/supersede
Reply all
Reply to author
Forward
0 new messages