Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Agent, Actions, Rules & Automation >> Word Count - Note and Descendants
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1186987255

Message started by Ellen on Aug 13th, 2007, 2:40am

Title: Word Count - Note and Descendants
Post by Ellen on Aug 13th, 2007, 2:40am

Is there are way to calculate the word count of a note and all its descendants?  I had something using MyCount=^sum(descendants,Wordcount)^ working a while back, but haven't wanted to do this for a while and it has slipped from my mind.  

I think it could also give a word count for everything below a given note, which could give an indication of where the wordcount is.

Any suggestions?

E.

Title: Re: Word Count - Note and Descendants
Post by Mark Anderson on Aug 13th, 2007, 10:33am

Almost there, you spelled the group operator 'descendant' wrong. Use:

Code:
MyCount=^sum(descendant,WordCount)^

See this page at aTbRef.

Title: Re: Word Count - Note and Descendants
Post by Ellen on Aug 13th, 2007, 8:31pm

My bad.  For some reason, it still does not want to work for me, either set in a prototype or in an individual note.

But, while looking at the attribute dialogue, each note says how many words are in the document including its descendants.  So, it would seem that Tinderbox is already keeping track of this information.  I wonder what attribute Tinderbox keeps this information in?

E.

Title: Re: Word Count - Note and Descendants
Post by Mark Bernstein on Aug 13th, 2007, 9:40pm

Modern Tinderbox 4 syntax is cleaner (and less error-prone) than Mark Anderson's solution, IMHO:
[edit]
count=sum(descendent,$WordCount)
[/edit]

where count is a numeric user attribute.

I tested this and verified that it does work as expected.

Title: Re: Word Count - Note and Descendants
Post by Mark Anderson on Aug 14th, 2007, 4:50am

Mea culpa. Old habits die hard. I've updated the aTbRef page referred to above (though  I bypassed the RSS feed).

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.