Tinderbox Forum

New user attribute results in zero

I want an attribute to appear in a parent note that gives the sum of its children $WordCount. But so far my attempts have failed, and I can’t figure out why.

I copied straight from the Tinderbox Reference File (sum(group, value)), changing only the name of the attribute.

Example: $MyNumber = sum(children,$WordCount);

My adaptation: $sumWordsChildren = sum(children,$WordCount); I’ve put this in the Action panel.

The result is always zero even for a set of a half dozen children whose total word count is 500+.

I’ve already made a handful of successful attempts at inserting action code, so I’m not completely new. I do know about the semicolon at the end, etc.

So what am I doing wrong?


My guess is there’s a typo!

Is the name of your attribute sumWordsChildren or SumWordsChildren? Attribute names are case-sensitive.

Also, is this a rule? An Edict?

Thanks for your reply, Mark.

It’s an action (what I understand to be like a rule or edict except that it occurs more quickly). The attribute really is “sumWordsChildren”. Lowercase S in “sum.”

Uploading or emailing the document — or just the piece in question — is likely to reveal the problem in seconds.

Here it is. Simplified version but otherwise consistent.
testing-TBXdoc.tbx (119.8 KB)

The Action (short for OnAdd action) runs when a note is added to the container, and it runs on the note being added.

You want to move this action to the container’s rule, which runs on the container every few seconds. And voila! sumWordsChildren=716

Ah! Thank you! I’m still finding my way around the basics.