How to get the total word count of a container?

Hello everyone!
I’m trying to figure out how I could see the sum of my total word count at the top of my container. As you can see on the second screenshot, I already use a MyNumber attribute to see the progression of my work in MapView. I suspect that this could be a redundant duplicate, am I wrong?
Thanks for your help.


I imagine you would have to sum the WordCount values of your descendants somewhere in your container, then use that computed value.

Maybe these would be helpful:

Counting words in an outline's note and all its child notes.

Searching for a nice dashboard.

The confusion of word count.

(PS - don’t have sufficient Discord skills to fold down the previews on the links, sorry!)

WordCount always applies to its note. So $WordCount for “Project d’article…” is the number of words in that note’s Text. It is read only, so you can’'t alter the value. It also means you can’t have the sum in the same column in view column. But, we do need to use another attribute:

Of course, in reality you would now hide wordCount column. How did I do this. firstly, via an action (stamp, rule, etc.) I made the children do this:

$MyNumber = $WordCount;

Now, in the container, I use this code:

$MyNumber = sum(children,$MyNumber);
// I could have summed $WordCount - it should be the same result!

Now the container is summing the child values and showing both figues in the same column.

Tip to get rid of decimal places for numbers in column view. The default is to show 2 decimal places:

Monosnap 2023-04-24 17-23-14

Change the value of ‘Decimals’ to zero and you will see the numbers as in my grab above.

1 Like

If you put a period immediately after the URL’s last character, the forum should suppress the preview box, like so:

Searching for a nice dashboard.

1 Like

Thank you for your answers. I did know these threads, and it works now:


However, and excuse-me if something missed me, but the problem I have is that, simultaneously, in Map View, my progress bar overwhelmed my container:

Would it be possible to have my progress bar, in Map View, and, in Outline View, my total word count?

Yes, but only if you hide the viewport (of the child map)—or so it seems from testing with bar() and vbar() patterns. The easiest way to do this is:

$TitleHeight = $Height;

If you look at $Pattern (in Displayed Attributes or Get Info) you will see the actual number being set.

Aha! You haven’t set a Maximum. As shown, pattern bar() is using the value of $MyNumber, which appears to be 20. If you only supply one number to the bar() pattern it assumes the number is a percentage. So your ‘Project’ currently plots a progress level off 204% (actually that means 100%, but thus you see no progress bar.

So, you need to work out what word count you will treat as 100% done and put that in the ‘Maximum’ box on the inspector (and zero for ‘minimum’, though I think that is assumed if missing.

Or instead of setting a min and max you can change the expression so that $MyNumber (or another number attribute) has a value between 0 and 100.

Don’t forget flags can be used for progress bars in both map and outline (or flag #1 if more than one.


1 Like

I had forgotten that there were flags. It’s a nice solution too! Thank you for your advices and your patience!