Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Word Count - Note and Descendants (Read 11072 times)
Ellen
Full Member
*
Offline



Posts: 2

Word Count - Note and Descendants
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.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Word Count - Note and Descendants
Reply #1 - 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.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Ellen
Full Member
*
Offline



Posts: 2

Re: Word Count - Note and Descendants
Reply #2 - 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.
Back to top
 
« Last Edit: Aug 13th, 2007, 9:23pm by Ellen »  
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Word Count - Note and Descendants
Reply #3 - Aug 13th, 2007, 9:40pm
 
Modern Tinderbox 4 syntax is cleaner (and less error-prone) than Mark Anderson's solution, IMHO:
Edited:

count=sum(descendent,$WordCount)


where count is a numeric user attribute.

I tested this and verified that it does work as expected.
Back to top
 
« Last Edit: Aug 13th, 2007, 9:41pm by Mark Bernstein »  
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Word Count - Note and Descendants
Reply #4 - 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).
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1
Send Topic Print